QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#233651#2701. Impressive IntegersFyind#WA 0ms3600kbC++201.9kb2023-10-31 20:52:552023-10-31 20:52:56

Judging History

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

  • [2023-10-31 20:52:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3600kb
  • [2023-10-31 20:52:55]
  • 提交

answer

#include <bits/stdc++.h>
#define mp(x, y) make_pair(x, y)
#define fi first 
#define se second
using namespace std;
int main() {
    #ifdef LLOCAL
    freopen("a.in", "r", stdin);
    #endif
    int n;
    cin >> n;
    --n;
    if (n == 0) {
        cout << 1 << ' ' << 0 << ' ' << 1 << '\n';
        cout << "A 0 0 U\n";
        return 0;
    }
    if (n == 1 || n == 2) {
        cout << "impossible\n";
        return 0; 
    }
    if (n % 2 == 0 && n % 4 != 0) {
        int m = n / 4;
        int a = 2, b = 2 * m - 1, c = 4 * m;
        cout << a << ' ' << b << ' ' << c << endl;
        int j = 0;
        for (int i = c; i > 4 * m - 2; i -= a) {
            for (int k = 0; k < i; k += a)
                cout << 'A' << ' ' << k << ' ' << j  << ' ' << 'U' << '\n';
            j += a;
            for (int k = 0; k < i - a; k += a)
                cout << 'A' << ' ' << k << ' ' << j << ' ' << 'D' << '\n';
        }
        for (int i = 4 * m - 2; i > 0; i -= b) {
            for (int k = 0; k < i; k += b)
                cout << 'B' << ' ' << k << ' ' << j << ' ' << 'U' << '\n';
            j += b;
            for (int k = 0; k < i - b; k += b)
                cout << 'B' << ' ' << k << ' ' << j << ' ' << 'D' << '\n';
        }
        // cout << 'B' << ' ' << 0 << ' ' << j << ' ' << 'U' << '\n';
        return 0;
    }
    int a = 1, b, c;
    if (n % 2 != 0)
        c = (1 + n) / 2, b = (n - 1) / 2;
    else 
        c = (2 + n / 2) / 2, b = (n / 2 - 2) / 2;
    cout << a << ' ' << b << ' ' << c << '\n';
    int j = 0;
    for (int i = c; i > b; --i) {
        for (int k = 0; k < i; ++k)
            cout << 'A' << ' ' << k << ' ' << j << ' ' << 'U' << '\n';
        ++j;
        for (int k = 0; k < i - 1; ++k)
            cout << 'A' << ' ' << k << ' ' << j << ' ' << 'D' << '\n';
    }
    cout << 'B' << ' ' << 0 << ' ' << j << ' ' << 'U' << '\n';

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

1 0 1
A 0 0 U

result:

wrong answer Value is lower than limit!