蒟蒻求问cf今晚div2 C
  • 板块学术版
  • 楼主__Seniorious__
  • 当前回复9
  • 已保存回复9
  • 发布时间2022/7/25 00:37
  • 上次更新2023/10/27 18:34:05
查看原帖
蒟蒻求问cf今晚div2 C
333119
__Seniorious__楼主2022/7/25 00:37

蒟蒻认为必须是整两行及以上/两列及以上,所以有如下的码:

#include <bits/stdc++.h>
using namespace std;
int _, k;
long long totx, toty, n, m, a, x, y;
bool mvx, mvy;
int main() {
    scanf("%d", &_);
    while (_--) {
        scanf("%lld%lld%d", &n, &m, &k);
        totx=0,toty=0,mvx=0,mvy=0;
        while(k--){
            scanf("%lld", &a);
            x = a / n, y = a / m;
            if (x >= 2ll)totx += x;
            if (y >= 2ll)toty += y;
            if (x > 2ll)mvx = true;
            if (y > 2ll)mvy = true;
        }
        if ((totx < m || ((totx == m + 1ll) && !mvx)) && (toty < n || ((toty == n + 1ll) && !mvy)))
            puts("No");
        else
            puts("Yes");
    }
    return 0;
}

WA on test 一晚上没调出来……

2022/7/25 00:37
加载中...