# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
133838 | 2019-07-21T13:59:17 Z | Kastanda | Nice sequence (IZhO18_sequence) | C++11 | 519 ms | 35476 KB |
// ItnoE #include<bits/stdc++.h> using namespace std; const int N = 400005; int n, m, q, k, ts, A[N]; void DFS(int v) { if (v - n >= 0 && !A[v - n]) DFS(v - n); if (v + m <= k && !A[v + m]) DFS(v + m); A[v] = ++ ts; } int main() { scanf("%d", &q); for (; q; q --) { scanf("%d%d", &n, &m); k = n + m - __gcd(n, m) - 1; for (int i = 0; i <= k; i ++) if (!A[i]) DFS(i); printf("%d\n", k); for (int i = 0; i < k; i ++) printf("%d ", A[i] - A[i + 1]); printf("\n"); for (int i = 0; i <= k; i ++) A[i] = 0; ts = 0; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Ok |
2 | Correct | 2 ms | 376 KB | Ok |
3 | Correct | 2 ms | 256 KB | Ok |
4 | Correct | 2 ms | 256 KB | Ok |
5 | Correct | 2 ms | 376 KB | Ok |
6 | Correct | 2 ms | 376 KB | Ok |
7 | Correct | 2 ms | 376 KB | Ok |
8 | Correct | 2 ms | 376 KB | Ok |
9 | Correct | 2 ms | 400 KB | Ok |
10 | Correct | 2 ms | 256 KB | Ok |
11 | Correct | 2 ms | 256 KB | Ok |
12 | Correct | 2 ms | 256 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Ok |
2 | Correct | 2 ms | 256 KB | Ok |
3 | Correct | 2 ms | 256 KB | Ok |
4 | Correct | 2 ms | 256 KB | Ok |
5 | Correct | 2 ms | 256 KB | Ok |
6 | Correct | 4 ms | 376 KB | Ok |
7 | Correct | 10 ms | 760 KB | Ok |
8 | Correct | 6 ms | 632 KB | Ok |
9 | Correct | 12 ms | 1144 KB | Ok |
10 | Correct | 7 ms | 632 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Ok |
2 | Correct | 2 ms | 256 KB | Ok |
3 | Correct | 2 ms | 256 KB | Ok |
4 | Correct | 2 ms | 376 KB | Ok |
5 | Correct | 2 ms | 376 KB | Ok |
6 | Correct | 2 ms | 376 KB | Ok |
7 | Correct | 2 ms | 256 KB | Ok |
8 | Correct | 2 ms | 376 KB | Ok |
9 | Correct | 2 ms | 376 KB | Ok |
10 | Correct | 2 ms | 252 KB | Ok |
11 | Correct | 2 ms | 376 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Ok |
2 | Correct | 2 ms | 256 KB | Ok |
3 | Correct | 2 ms | 256 KB | Ok |
4 | Correct | 3 ms | 256 KB | Ok |
5 | Correct | 2 ms | 376 KB | Ok |
6 | Correct | 85 ms | 6852 KB | Ok |
7 | Correct | 69 ms | 5624 KB | Ok |
8 | Correct | 126 ms | 8412 KB | Ok |
9 | Correct | 101 ms | 8056 KB | Ok |
10 | Correct | 61 ms | 4984 KB | Ok |
11 | Correct | 100 ms | 8952 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Ok |
2 | Correct | 2 ms | 376 KB | Ok |
3 | Correct | 2 ms | 256 KB | Ok |
4 | Correct | 2 ms | 256 KB | Ok |
5 | Correct | 2 ms | 376 KB | Ok |
6 | Correct | 2 ms | 376 KB | Ok |
7 | Correct | 2 ms | 376 KB | Ok |
8 | Correct | 2 ms | 376 KB | Ok |
9 | Correct | 2 ms | 400 KB | Ok |
10 | Correct | 2 ms | 256 KB | Ok |
11 | Correct | 2 ms | 256 KB | Ok |
12 | Correct | 2 ms | 256 KB | Ok |
13 | Correct | 2 ms | 376 KB | Ok |
14 | Correct | 2 ms | 256 KB | Ok |
15 | Correct | 2 ms | 256 KB | Ok |
16 | Correct | 2 ms | 376 KB | Ok |
17 | Correct | 2 ms | 376 KB | Ok |
18 | Correct | 2 ms | 376 KB | Ok |
19 | Correct | 2 ms | 256 KB | Ok |
20 | Correct | 2 ms | 376 KB | Ok |
21 | Correct | 2 ms | 376 KB | Ok |
22 | Correct | 2 ms | 252 KB | Ok |
23 | Correct | 2 ms | 376 KB | Ok |
24 | Correct | 4 ms | 376 KB | Ok |
25 | Correct | 4 ms | 376 KB | Ok |
26 | Correct | 4 ms | 376 KB | Ok |
27 | Correct | 4 ms | 364 KB | Ok |
28 | Correct | 3 ms | 376 KB | Ok |
29 | Correct | 3 ms | 376 KB | Ok |
30 | Correct | 3 ms | 376 KB | Ok |
31 | Correct | 3 ms | 376 KB | Ok |
32 | Correct | 4 ms | 376 KB | Ok |
33 | Correct | 3 ms | 376 KB | Ok |
34 | Correct | 5 ms | 504 KB | Ok |
35 | Correct | 5 ms | 508 KB | Ok |
36 | Correct | 5 ms | 632 KB | Ok |
37 | Correct | 5 ms | 504 KB | Ok |
38 | Correct | 5 ms | 504 KB | Ok |
39 | Correct | 5 ms | 504 KB | Ok |
40 | Correct | 5 ms | 632 KB | Ok |
41 | Correct | 5 ms | 504 KB | Ok |
42 | Correct | 6 ms | 504 KB | Ok |
43 | Correct | 5 ms | 504 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Ok |
2 | Correct | 2 ms | 376 KB | Ok |
3 | Correct | 2 ms | 256 KB | Ok |
4 | Correct | 2 ms | 256 KB | Ok |
5 | Correct | 2 ms | 376 KB | Ok |
6 | Correct | 2 ms | 376 KB | Ok |
7 | Correct | 2 ms | 376 KB | Ok |
8 | Correct | 2 ms | 376 KB | Ok |
9 | Correct | 2 ms | 400 KB | Ok |
10 | Correct | 2 ms | 256 KB | Ok |
11 | Correct | 2 ms | 256 KB | Ok |
12 | Correct | 2 ms | 256 KB | Ok |
13 | Correct | 2 ms | 256 KB | Ok |
14 | Correct | 2 ms | 256 KB | Ok |
15 | Correct | 2 ms | 256 KB | Ok |
16 | Correct | 2 ms | 256 KB | Ok |
17 | Correct | 2 ms | 256 KB | Ok |
18 | Correct | 4 ms | 376 KB | Ok |
19 | Correct | 10 ms | 760 KB | Ok |
20 | Correct | 6 ms | 632 KB | Ok |
21 | Correct | 12 ms | 1144 KB | Ok |
22 | Correct | 7 ms | 632 KB | Ok |
23 | Correct | 2 ms | 376 KB | Ok |
24 | Correct | 2 ms | 256 KB | Ok |
25 | Correct | 2 ms | 256 KB | Ok |
26 | Correct | 2 ms | 376 KB | Ok |
27 | Correct | 2 ms | 376 KB | Ok |
28 | Correct | 2 ms | 376 KB | Ok |
29 | Correct | 2 ms | 256 KB | Ok |
30 | Correct | 2 ms | 376 KB | Ok |
31 | Correct | 2 ms | 376 KB | Ok |
32 | Correct | 2 ms | 252 KB | Ok |
33 | Correct | 2 ms | 376 KB | Ok |
34 | Correct | 4 ms | 376 KB | Ok |
35 | Correct | 4 ms | 376 KB | Ok |
36 | Correct | 4 ms | 376 KB | Ok |
37 | Correct | 4 ms | 364 KB | Ok |
38 | Correct | 3 ms | 376 KB | Ok |
39 | Correct | 3 ms | 376 KB | Ok |
40 | Correct | 3 ms | 376 KB | Ok |
41 | Correct | 3 ms | 376 KB | Ok |
42 | Correct | 4 ms | 376 KB | Ok |
43 | Correct | 3 ms | 376 KB | Ok |
44 | Correct | 5 ms | 504 KB | Ok |
45 | Correct | 5 ms | 508 KB | Ok |
46 | Correct | 5 ms | 632 KB | Ok |
47 | Correct | 5 ms | 504 KB | Ok |
48 | Correct | 5 ms | 504 KB | Ok |
49 | Correct | 5 ms | 504 KB | Ok |
50 | Correct | 5 ms | 632 KB | Ok |
51 | Correct | 5 ms | 504 KB | Ok |
52 | Correct | 6 ms | 504 KB | Ok |
53 | Correct | 5 ms | 504 KB | Ok |
54 | Correct | 61 ms | 2868 KB | Ok |
55 | Correct | 70 ms | 3320 KB | Ok |
56 | Correct | 70 ms | 3292 KB | Ok |
57 | Correct | 56 ms | 2424 KB | Ok |
58 | Correct | 69 ms | 3064 KB | Ok |
59 | Correct | 62 ms | 3064 KB | Ok |
60 | Correct | 55 ms | 2680 KB | Ok |
61 | Correct | 55 ms | 2680 KB | Ok |
62 | Correct | 71 ms | 3448 KB | Ok |
63 | Correct | 58 ms | 2808 KB | Ok |
64 | Correct | 69 ms | 3192 KB | Ok |
65 | Correct | 69 ms | 3064 KB | Ok |
66 | Correct | 60 ms | 2808 KB | Ok |
67 | Correct | 53 ms | 2552 KB | Ok |
68 | Correct | 64 ms | 2936 KB | Ok |
69 | Correct | 120 ms | 8324 KB | Ok |
70 | Correct | 124 ms | 8700 KB | Ok |
71 | Correct | 114 ms | 7800 KB | Ok |
72 | Correct | 113 ms | 8312 KB | Ok |
73 | Correct | 117 ms | 7856 KB | Ok |
74 | Correct | 113 ms | 7928 KB | Ok |
75 | Correct | 115 ms | 8356 KB | Ok |
76 | Correct | 119 ms | 8440 KB | Ok |
77 | Correct | 122 ms | 7928 KB | Ok |
78 | Correct | 124 ms | 8184 KB | Ok |
79 | Correct | 118 ms | 8316 KB | Ok |
80 | Correct | 116 ms | 7704 KB | Ok |
81 | Correct | 122 ms | 8568 KB | Ok |
82 | Correct | 114 ms | 8104 KB | Ok |
83 | Correct | 117 ms | 8412 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Ok |
2 | Correct | 2 ms | 376 KB | Ok |
3 | Correct | 2 ms | 256 KB | Ok |
4 | Correct | 2 ms | 256 KB | Ok |
5 | Correct | 2 ms | 376 KB | Ok |
6 | Correct | 2 ms | 376 KB | Ok |
7 | Correct | 2 ms | 376 KB | Ok |
8 | Correct | 2 ms | 376 KB | Ok |
9 | Correct | 2 ms | 400 KB | Ok |
10 | Correct | 2 ms | 256 KB | Ok |
11 | Correct | 2 ms | 256 KB | Ok |
12 | Correct | 2 ms | 256 KB | Ok |
13 | Correct | 2 ms | 256 KB | Ok |
14 | Correct | 2 ms | 256 KB | Ok |
15 | Correct | 2 ms | 256 KB | Ok |
16 | Correct | 2 ms | 256 KB | Ok |
17 | Correct | 2 ms | 256 KB | Ok |
18 | Correct | 4 ms | 376 KB | Ok |
19 | Correct | 10 ms | 760 KB | Ok |
20 | Correct | 6 ms | 632 KB | Ok |
21 | Correct | 12 ms | 1144 KB | Ok |
22 | Correct | 7 ms | 632 KB | Ok |
23 | Correct | 2 ms | 376 KB | Ok |
24 | Correct | 2 ms | 256 KB | Ok |
25 | Correct | 2 ms | 256 KB | Ok |
26 | Correct | 2 ms | 376 KB | Ok |
27 | Correct | 2 ms | 376 KB | Ok |
28 | Correct | 2 ms | 376 KB | Ok |
29 | Correct | 2 ms | 256 KB | Ok |
30 | Correct | 2 ms | 376 KB | Ok |
31 | Correct | 2 ms | 376 KB | Ok |
32 | Correct | 2 ms | 252 KB | Ok |
33 | Correct | 2 ms | 376 KB | Ok |
34 | Correct | 2 ms | 376 KB | Ok |
35 | Correct | 2 ms | 256 KB | Ok |
36 | Correct | 2 ms | 256 KB | Ok |
37 | Correct | 3 ms | 256 KB | Ok |
38 | Correct | 2 ms | 376 KB | Ok |
39 | Correct | 85 ms | 6852 KB | Ok |
40 | Correct | 69 ms | 5624 KB | Ok |
41 | Correct | 126 ms | 8412 KB | Ok |
42 | Correct | 101 ms | 8056 KB | Ok |
43 | Correct | 61 ms | 4984 KB | Ok |
44 | Correct | 100 ms | 8952 KB | Ok |
45 | Correct | 4 ms | 376 KB | Ok |
46 | Correct | 4 ms | 376 KB | Ok |
47 | Correct | 4 ms | 376 KB | Ok |
48 | Correct | 4 ms | 364 KB | Ok |
49 | Correct | 3 ms | 376 KB | Ok |
50 | Correct | 3 ms | 376 KB | Ok |
51 | Correct | 3 ms | 376 KB | Ok |
52 | Correct | 3 ms | 376 KB | Ok |
53 | Correct | 4 ms | 376 KB | Ok |
54 | Correct | 3 ms | 376 KB | Ok |
55 | Correct | 5 ms | 504 KB | Ok |
56 | Correct | 5 ms | 508 KB | Ok |
57 | Correct | 5 ms | 632 KB | Ok |
58 | Correct | 5 ms | 504 KB | Ok |
59 | Correct | 5 ms | 504 KB | Ok |
60 | Correct | 5 ms | 504 KB | Ok |
61 | Correct | 5 ms | 632 KB | Ok |
62 | Correct | 5 ms | 504 KB | Ok |
63 | Correct | 6 ms | 504 KB | Ok |
64 | Correct | 5 ms | 504 KB | Ok |
65 | Correct | 61 ms | 2868 KB | Ok |
66 | Correct | 70 ms | 3320 KB | Ok |
67 | Correct | 70 ms | 3292 KB | Ok |
68 | Correct | 56 ms | 2424 KB | Ok |
69 | Correct | 69 ms | 3064 KB | Ok |
70 | Correct | 62 ms | 3064 KB | Ok |
71 | Correct | 55 ms | 2680 KB | Ok |
72 | Correct | 55 ms | 2680 KB | Ok |
73 | Correct | 71 ms | 3448 KB | Ok |
74 | Correct | 58 ms | 2808 KB | Ok |
75 | Correct | 69 ms | 3192 KB | Ok |
76 | Correct | 69 ms | 3064 KB | Ok |
77 | Correct | 60 ms | 2808 KB | Ok |
78 | Correct | 53 ms | 2552 KB | Ok |
79 | Correct | 64 ms | 2936 KB | Ok |
80 | Correct | 120 ms | 8324 KB | Ok |
81 | Correct | 124 ms | 8700 KB | Ok |
82 | Correct | 114 ms | 7800 KB | Ok |
83 | Correct | 113 ms | 8312 KB | Ok |
84 | Correct | 117 ms | 7856 KB | Ok |
85 | Correct | 113 ms | 7928 KB | Ok |
86 | Correct | 115 ms | 8356 KB | Ok |
87 | Correct | 119 ms | 8440 KB | Ok |
88 | Correct | 122 ms | 7928 KB | Ok |
89 | Correct | 124 ms | 8184 KB | Ok |
90 | Correct | 118 ms | 8316 KB | Ok |
91 | Correct | 116 ms | 7704 KB | Ok |
92 | Correct | 122 ms | 8568 KB | Ok |
93 | Correct | 114 ms | 8104 KB | Ok |
94 | Correct | 117 ms | 8412 KB | Ok |
95 | Correct | 160 ms | 6968 KB | Ok |
96 | Correct | 224 ms | 10112 KB | Ok |
97 | Correct | 215 ms | 9168 KB | Ok |
98 | Correct | 168 ms | 7544 KB | Ok |
99 | Correct | 192 ms | 8176 KB | Ok |
100 | Correct | 198 ms | 9084 KB | Ok |
101 | Correct | 198 ms | 8572 KB | Ok |
102 | Correct | 204 ms | 8828 KB | Ok |
103 | Correct | 188 ms | 8980 KB | Ok |
104 | Correct | 228 ms | 10028 KB | Ok |
105 | Correct | 222 ms | 9976 KB | Ok |
106 | Correct | 182 ms | 8312 KB | Ok |
107 | Correct | 207 ms | 9208 KB | Ok |
108 | Correct | 232 ms | 10508 KB | Ok |
109 | Correct | 211 ms | 9340 KB | Ok |
110 | Correct | 466 ms | 34296 KB | Ok |
111 | Correct | 519 ms | 35476 KB | Ok |
112 | Correct | 499 ms | 33504 KB | Ok |
113 | Correct | 488 ms | 34552 KB | Ok |
114 | Correct | 503 ms | 33388 KB | Ok |
115 | Correct | 496 ms | 35448 KB | Ok |
116 | Correct | 500 ms | 35428 KB | Ok |
117 | Correct | 504 ms | 34816 KB | Ok |
118 | Correct | 493 ms | 32888 KB | Ok |
119 | Correct | 497 ms | 34552 KB | Ok |
120 | Correct | 495 ms | 35164 KB | Ok |
121 | Correct | 512 ms | 33784 KB | Ok |
122 | Correct | 481 ms | 35192 KB | Ok |
123 | Correct | 496 ms | 34296 KB | Ok |
124 | Correct | 518 ms | 33528 KB | Ok |
125 | Correct | 363 ms | 18112 KB | Ok |