QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#837924#9954. Magic PointswsyearWA 1ms3636kbC++201.2kb2024-12-30 16:43:112024-12-30 16:43:13

Judging History

This is the latest submission verdict.

  • [2024-12-30 16:43:13]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3636kb
  • [2024-12-30 16:43:11]
  • Submitted

answer

// Author: Donomonayuas

#include <bits/stdc++.h>

#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

template<class T> inline void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T> inline void chkmx(T &x, T y) { if (y > x) x = y; }

using namespace std;

const int maxn = 1010;

int n, a[maxn], b[maxn], ans[maxn];

void work() {
  cin >> n;
  rep (i, 1, n) a[i] = 3 * (n - 1) - i + 1;
  rep (i, 1, n) b[i] = i - 1;
  if (n & 1) {
    int pos = 2;
    rep (i, 1, n / 2) ans[i] = b[pos], pos += 2;
    pos = 1;
    rep (i, n / 2 + 2, n) ans[i] = b[pos], pos += 2;
    ans[n / 2 + 1] = 2 * n - 3;
  } else {
    int pos = 2;
    rep (i, 1, n / 2) ans[i] = b[pos], pos += 2;
    pos = 1;
    rep (i, n / 2 + 1, n) ans[i] = b[pos], pos += 2;
  }
  rep (i, 1, n) cout << a[i] << " " << ans[i] << ' ';
  cout << '\n';
}

int main() {
  cin.tie(nullptr) -> ios::sync_with_stdio(false);
  int t; cin >> t;
  while (t--) work();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
2
3
4

output:

3 1 2 0 
6 1 5 3 4 0 
9 1 8 3 7 0 6 2 

result:

ok OK

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3636kb

input:

114
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
999
1000
997
998
337
551
667
444
512
768
897
256
137
128
199
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
...

output:

3 1 2 0 
6 1 5 3 4 0 
9 1 8 3 7 0 6 2 
12 1 11 3 10 7 9 0 8 2 
15 1 14 3 13 5 12 0 11 2 10 4 
18 1 17 3 16 5 15 11 14 0 13 2 12 4 
21 1 20 3 19 5 18 7 17 0 16 2 15 4 14 6 
24 1 23 3 22 5 21 7 20 15 19 0 18 2 17 4 16 6 
27 1 26 3 25 5 24 7 23 9 22 0 21 2 20 4 19 6 18 8 
30 1 29 3 28 5 27 7 26 9 25 19...

result:

wrong answer Case n=6: line{1,2,3} concurrent