QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#825001#9768. A + B = C Problemucup-team296#WA 0ms3648kbC++202.3kb2024-12-21 16:53:282024-12-21 16:53:44

Judging History

This is the latest submission verdict.

  • [2024-12-21 16:53:44]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3648kb
  • [2024-12-21 16:53:28]
  • Submitted

answer

#include <bits/stdc++.h>

#define long long long int
#define DEBUG
using namespace std;

// @author: pashka

struct test {
    void solve() {
        vector<long> a(3);
        cin >> a[0] >> a[1] >> a[2];
        if (a[0] == a[1] && a[0] == a[2]) {
            if (a[0] == 2) {
                cout << "NO\n";
                return;
            }
            cout << "YES\n";
            for (int i = 0; i < a[0]; i++) {
                cout << (i == 0);
            }
            cout << "\n";
            for (int i = 0; i < a[0]; i++) {
                cout << (i == 1);
            }
            cout << "\n";
            for (int i = 0; i < a[0]; i++) {
                cout << (i <= 1);
            }
            cout << "\n";
            return;
        }
        for (int j = 0; j < 3; j++) {
            int x = (j + 1) % 3;
            int y = (j + 2) % 3;
            if (a[j] == a[x] / gcd(a[x], a[y]) * a[y]) {
                vector<string> res(3);
                for (int i = 0; i < a[x]; i++) {
                    res[x] += '0' + (i == 0);
                }
                for (int i = 0; i < a[y]; i++) {
                    res[y] += '0' + (i == 0);
                }
                for (int i = 0; i < a[j]; i++) {
                    res[j] += '0' + ((i % a[x] == 0) ^ (i % a[y] == 0));
                }
                cout << "YES\n" << res[0] << "\n" << res[1] << "\n" << res[2] << "\n";
            }
            if (a[x] % 2 == 0 && a[y] % 2 == 0 && a[j] == a[x] / gcd(a[x], a[y]) * a[y] / 2) {
                vector<string> res(3);
                for (int i = 0; i < a[x]; i++) {
                    res[x] += '0' + (i < a[x] / 2);
                }
                for (int i = 0; i < a[y]; i++) {
                    res[y] += '0' + (i < a[y] / 2);
                }
                for (int i = 0; i < a[j]; i++) {
                    res[j] += '0' + ((i % a[x] < a[x] / 2) ^ (i % a[y] < a[y] / 2));
                }
                cout << "YES\n" << res[0] << "\n" << res[1] << "\n" << res[2] << "\n";
            }
        }
        cout << "NO\n";
        return;
    }
};

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        test().solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
2 3 6
2 3 5

output:

YES
10
010
111000
YES
10
100
001110
NO
NO

result:

wrong answer Invalid output! (test case 2)