QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#817309#7333. Dominoeshbq2004#WA 0ms3652kbC++23919b2024-12-16 21:35:172024-12-16 21:35:17

Judging History

This is the latest submission verdict.

  • [2024-12-16 21:35:17]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3652kb
  • [2024-12-16 21:35:17]
  • Submitted

answer

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

void solve() {
    int n;
    cin >> n;
    if (n >= 4) {
        cout << "impossible\n";
    } else if (n == 1) {
        cout << "1 1 1 2\n";
    } else if (n == 2) {
        cout << "1 1 1 2\n";
        cout << "1 3 1 4\n";
        cout << "1 5 1 6\n";
    } else {
        cout << "1 1 1 2\n";
        cout << "1 3 2 3\n";
        cout << "1 4 2 4\n";
        cout << "2 1 2 2\n";
        cout << "3 3 3 4\n";
        cout << "2 5 3 5\n";
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}

/*

Constructive:

有 [n * (n + 1) / 2] 个多米诺骨牌:
(1, 1), (1, 2) .. (1, n)
        (2, 2) .. (2, n)
..
                  (n, n)

求放置方案, 使得多米诺骨牌上的所有相同的数字都相邻

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3652kb

input:

1
2

output:

1 1 1 2
1 3 1 4
1 5 1 6

result:

ok OK!

Test #2:

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

input:

50
888
171
6
7
8
9
10
1000
1
2
3
4
5
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
71
172
516
669
997

output:

impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
1 1 1 2
1 1 1 2
1 3 1 4
1 5 1 6
1 1 1 2
1 3 2 3
1 4 2 4
2 1 2 2
3 3 3 4
2 5 3 5
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
...

result:

wrong output format Expected integer, but "impossible" found