QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#666972#5438. Half Mixedadivse#WA 0ms3560kbC++202.3kb2024-10-22 20:34:482024-10-22 20:35:10

Judging History

你现在查看的是最新测评结果

  • [2024-10-22 20:35:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3560kb
  • [2024-10-22 20:34:48]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#define endl '\n'
#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define rep2(i,a,b) for(int i=(a);i>=(b);i--)
using namespace std;
template<typename T>
void bu(vector<T> tem) { for (auto x : tem) cout << x << ' '; cout << endl; }
void bu(int a) { cout << a << endl; }
void bu(int a, int b) { cout << a << ' ' << b << endl; }
void bu(int a, int b, int c) { cout << a << ' ' << b << ' ' << c << endl; }
void kuaidu() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); }
inline int max(int a, int b) { if (a < b) return b; return a; }
inline int min(int a, int b) { if (a < b) return a; return b; }
using PII = pair<int, int>;
using i128 = __int128;

//--------------------------------------------------------------------------------
const int N = 1e3 + 10;
const int M = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 1e16;
int n, m, T;

//--------------------------------------------------------------------------------


signed main() {
    kuaidu();
    T = 1; cin >> T;
    while (T--) {
        cin >> n >> m;
        int x = (n + 1) * (m + 1) / 2;
        int fl = 0, r, c;

        vector<vector<int>> A;
        A.resize(n + 10);
        rep(i, 0, n) A[i].resize(m + 10);

        rep(i, 1, x) {
            if (x % i != 0) continue;
            int a = i, b = x / i;
            a -= 1, b -= 1;
            if (!a or !b) continue;
            if (n % a) continue;
            if (m % b) continue;
            fl = 1;
            r = a, c = b; break;
        }

        if (!fl) {
            cout << "No" << endl;
            continue;
        }
        cout << "Yes" << endl;
        int cnt = 0;
        for (int i = 1; i <= n; i += r) {

            int lf = 1; cnt++; if (cnt % 2) lf = 0;
            for (int j = 1; j <= m; j += c) {
                // cout << i << " " << j << endl;
                lf = 1 - lf;
                rep(a, i, i + r - 1) rep(b, j, j + c - 1) {
                    A[a][b] = lf;
                }

            }
        }

        rep(i, 1, n) {
            rep(j, 1, m) cout << A[i][j];
            cout << endl;
        }

    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3560kb

input:

2
2 3
1 1

output:

Yes
101
101
No

result:

wrong answer Integer parameter [name=M[i][j]] equals to 101, violates the range [0, 1] (test case 1)