# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
964295 | 2024-04-16T15:13:26 Z | maxFedorchuk | 곤돌라 (IOI14_gondola) | C++17 | 23 ms | 5332 KB |
#include <bits/stdc++.h> using namespace std; #include "gondola.h" int valid(int n, int inputSeq[]) { set < int > st; int p=0; for(int i=0;i<n;i++) { if(inputSeq[i]<=n) { p=(n+i-inputSeq[i])%n; } st.insert(inputSeq[i]); } if(st.size()!=n) { return 0; } for(int i=0;i<n;i++) { if(inputSeq[i]<=n) { if((n+i-inputSeq[i])%n!=p) { return 0; } } } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { int ned_to_be[n],in=-1; for(int i=0;i<n;i++) { if(gondolaSeq[i]<=n) { ned_to_be[i]=gondolaSeq[i]; in=i; break; } } if(in!=-1) { int nd=ned_to_be[in]; for(int i=(in+1)%n;i!=in;i=(i+1)%n) { nd%=n; nd++; ned_to_be[i]=nd; } } else { for(int i=0;i<n;i++) { ned_to_be[i]=i+1; } } map < int , int > mp; int mx=0; for(int i=0;i<n;i++) { if(gondolaSeq[i]>mx) { mx=gondolaSeq[i]; in=i; } if(gondolaSeq[i]>n) { mp[gondolaSeq[i]]=ned_to_be[i]; } } int uk=0; for(int i=n+1;i<=mx;i++,uk++) { if(mp.find(i)==mp.end() || i==mx) { replacementSeq[uk]=ned_to_be[in]; ned_to_be[in]=i; } else { replacementSeq[uk]=mp[i]; } } return uk; } //---------------------- int countReplacement(int n, int inputSeq[]) { }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 504 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 8 ms | 2392 KB | Output is correct |
7 | Correct | 20 ms | 4252 KB | Output is correct |
8 | Correct | 15 ms | 4444 KB | Output is correct |
9 | Correct | 5 ms | 1704 KB | Output is correct |
10 | Correct | 20 ms | 5008 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 600 KB | Output is correct |
6 | Correct | 10 ms | 2392 KB | Output is correct |
7 | Correct | 20 ms | 4156 KB | Output is correct |
8 | Correct | 15 ms | 4400 KB | Output is correct |
9 | Correct | 5 ms | 1624 KB | Output is correct |
10 | Correct | 18 ms | 4956 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 9 ms | 2396 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 23 ms | 5332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 436 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 444 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 352 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 448 KB | Output is correct |
8 | Correct | 1 ms | 436 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 440 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 7 ms | 1456 KB | Output is correct |
12 | Correct | 7 ms | 1628 KB | Output is correct |
13 | Correct | 20 ms | 2792 KB | Output is correct |
14 | Correct | 6 ms | 1368 KB | Output is correct |
15 | Correct | 22 ms | 3156 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 344 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 352 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |