# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
751689 | 2023-06-01T08:30:05 Z | sofija6 | Xylophone (JOI18_xylophone) | C++14 | 2000 ms | 712 KB |
#include "xylophone.h" #include <bits/stdc++.h> using namespace std; static int A[5000]; void solve(int N) { int diff2[N+2],diff3[N+2]; for (int i=1;i<N;i++) { if (i<N-1) diff3[i]=query(i,i+2); diff2[i]=query(i,i+1); } for (int i=1;i<=N;i++) { int cur=1; A[1]=i; for (int j=2;j<=N;j++) { if (j>2 && N>2 && diff3[j-2]!=diff2[j-2]+diff2[j-1]) cur*=(-1); A[j]=A[j-1]+diff2[j-1]*cur; } set<int> s; bool yes=true; for (int j=1;j<=N;j++) { if (A[j]<=N && A[j]>=1) { if (A[j]==N && !s.count(1)) yes=false; s.insert(A[j]); } } if (s.size()==N && yes) { for (int j=1;j<=N;j++) answer(j,A[j]); return; } yes=true; s.clear(); cur=-1; for (int j=2;j<=N;j++) { if (j>2 && N>2 && diff3[j-2]!=diff2[j-2]+diff2[j-1]) cur*=(-1); A[j]=A[j-1]+diff2[j-1]*cur; } for (int j=1;j<=N;j++) { if (A[j]<=N && A[j]>=1) { if (A[j]==N && !s.count(1)) yes=false; s.insert(A[j]); } } if (s.size()==N && yes) { for (int j=1;j<=N;j++) answer(j,A[j]); return; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 2 ms | 208 KB | Output is correct |
5 | Correct | 3 ms | 208 KB | Output is correct |
6 | Correct | 2 ms | 208 KB | Output is correct |
7 | Correct | 3 ms | 208 KB | Output is correct |
8 | Correct | 3 ms | 208 KB | Output is correct |
9 | Correct | 2 ms | 208 KB | Output is correct |
10 | Correct | 2 ms | 208 KB | Output is correct |
11 | Correct | 2 ms | 208 KB | Output is correct |
12 | Correct | 2 ms | 208 KB | Output is correct |
13 | Correct | 3 ms | 208 KB | Output is correct |
14 | Correct | 3 ms | 208 KB | Output is correct |
15 | Correct | 2 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 2 ms | 208 KB | Output is correct |
5 | Correct | 3 ms | 208 KB | Output is correct |
6 | Correct | 2 ms | 208 KB | Output is correct |
7 | Correct | 3 ms | 208 KB | Output is correct |
8 | Correct | 3 ms | 208 KB | Output is correct |
9 | Correct | 2 ms | 208 KB | Output is correct |
10 | Correct | 2 ms | 208 KB | Output is correct |
11 | Correct | 2 ms | 208 KB | Output is correct |
12 | Correct | 2 ms | 208 KB | Output is correct |
13 | Correct | 3 ms | 208 KB | Output is correct |
14 | Correct | 3 ms | 208 KB | Output is correct |
15 | Correct | 2 ms | 208 KB | Output is correct |
16 | Correct | 6 ms | 208 KB | Output is correct |
17 | Correct | 29 ms | 304 KB | Output is correct |
18 | Correct | 43 ms | 316 KB | Output is correct |
19 | Correct | 115 ms | 328 KB | Output is correct |
20 | Correct | 118 ms | 296 KB | Output is correct |
21 | Correct | 123 ms | 340 KB | Output is correct |
22 | Correct | 117 ms | 332 KB | Output is correct |
23 | Correct | 9 ms | 312 KB | Output is correct |
24 | Correct | 79 ms | 296 KB | Output is correct |
25 | Correct | 16 ms | 304 KB | Output is correct |
26 | Correct | 125 ms | 340 KB | Output is correct |
27 | Correct | 58 ms | 288 KB | Output is correct |
28 | Correct | 33 ms | 288 KB | Output is correct |
29 | Correct | 122 ms | 336 KB | Output is correct |
30 | Correct | 36 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 2 ms | 208 KB | Output is correct |
5 | Correct | 3 ms | 208 KB | Output is correct |
6 | Correct | 2 ms | 208 KB | Output is correct |
7 | Correct | 3 ms | 208 KB | Output is correct |
8 | Correct | 3 ms | 208 KB | Output is correct |
9 | Correct | 2 ms | 208 KB | Output is correct |
10 | Correct | 2 ms | 208 KB | Output is correct |
11 | Correct | 2 ms | 208 KB | Output is correct |
12 | Correct | 2 ms | 208 KB | Output is correct |
13 | Correct | 3 ms | 208 KB | Output is correct |
14 | Correct | 3 ms | 208 KB | Output is correct |
15 | Correct | 2 ms | 208 KB | Output is correct |
16 | Correct | 6 ms | 208 KB | Output is correct |
17 | Correct | 29 ms | 304 KB | Output is correct |
18 | Correct | 43 ms | 316 KB | Output is correct |
19 | Correct | 115 ms | 328 KB | Output is correct |
20 | Correct | 118 ms | 296 KB | Output is correct |
21 | Correct | 123 ms | 340 KB | Output is correct |
22 | Correct | 117 ms | 332 KB | Output is correct |
23 | Correct | 9 ms | 312 KB | Output is correct |
24 | Correct | 79 ms | 296 KB | Output is correct |
25 | Correct | 16 ms | 304 KB | Output is correct |
26 | Correct | 125 ms | 340 KB | Output is correct |
27 | Correct | 58 ms | 288 KB | Output is correct |
28 | Correct | 33 ms | 288 KB | Output is correct |
29 | Correct | 122 ms | 336 KB | Output is correct |
30 | Correct | 36 ms | 336 KB | Output is correct |
31 | Correct | 236 ms | 404 KB | Output is correct |
32 | Correct | 1181 ms | 560 KB | Output is correct |
33 | Correct | 1426 ms | 520 KB | Output is correct |
34 | Execution timed out | 2751 ms | 712 KB | Time limit exceeded |
35 | Halted | 0 ms | 0 KB | - |