QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#233655#2701. Impressive IntegersFyindWA 0ms3736kbC++201.9kb2023-10-31 20:55:442023-10-31 20:55:44

Judging History

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

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

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 << ' ' << 1 << ' ' << 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: 100
Accepted
time: 0ms
memory: 3736kb

input:

1

output:

1 1 1
A 0 0 U

result:

ok 

Test #2:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

2

output:

impossible

result:

ok 

Test #3:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

3

output:

impossible

result:

ok 

Test #4:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

4

output:

1 1 2
A 0 0 U
A 1 0 U
A 0 1 D
B 0 1 U

result:

ok 

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3592kb

input:

5

output:

1 0 2
A 0 0 U
A 1 0 U
A 0 1 D
A 0 1 U
B 0 2 U

result:

wrong answer Expected impossible