QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#709887#5465. Maximum GCD123456zmy#RE 0ms0kbC++171.3kb2024-11-04 17:19:012024-11-04 17:19:05

Judging History

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

  • [2024-11-04 17:19:05]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-11-04 17:19:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

#define int long long
#define endl '\n'

void solve()
{
    int n, m;
    cin >> n >> m;

    bool f = 0;
    if (n % 2) {
        swap(n, m);
        f = 1;
    }

    if (n * m % 2) {
        cout << "NO\n";
        return;
    }
    int mn = min(n, m), mx = min(n, m);
    if (mn <= 10 && pow(2, mn) < mx) {
        cout << "NO\n";
        return;
    }
    cout << "YES\n";

    vector<vector<int>> v;
    for (int i = 0; i < m / 2; i++) {
        vector<int> t1(n), t2(n);
        for (int j = 0; j < n; j++) {
            if (j <= 10) t1[j] = (i >> j) & 1;
            else break;
        }
        for (int j = 0; j < n; j++) {
            t2[j] = 1 - t1[j];
        }
        v.push_back(t1);
        v.push_back(t2);
    }
    if (m % 2) {
        vector<int> t;
        for (int i = 0; i < n / 2; i++)
            t[i] = 1;
        v.push_back(t);
    }
    sort(v.begin(), v.end());

    for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) {
            cout << v[i][j];
        }
        cout << endl;
    }
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);

    int t;
    cin >> t;

    while (t--)
        solve();
}

詳細信息

Test #1:

score: 0
Runtime Error

input:

3
3 10 7

output:


result: