# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
52099 | 2018-06-23T22:21:00 Z | spencercompton | 곤돌라 (IOI14_gondola) | C++17 | 53 ms | 5108 KB |
#include <bits/stdc++.h> #include "gondola.h" using namespace std; int valid(int n, int inputSeq[]) { set<int> ss; for(int i = 0; i<n; i++){ ss.insert(inputSeq[i]); } if(ss.size()!=n){ return 0; } pair<int, int> first; first.first = n+1; first.second = -1; for(int i = 0; i<n; i++){ if(inputSeq[i]<first.first){ first.first = inputSeq[i]; first.second = i; } } if(first.second==-1){ return 1; } int pos = first.second; for(int i = 0; i<n; i++){ if(inputSeq[i]<=n && i!=((first.second+inputSeq[i]-first.first)%n)){ return 0; } } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { pair<int, int> first; first.first = n+1; first.second = -1; for(int i = 0; i<n; i++){ if(gondolaSeq[i]<first.first){ first.first = gondolaSeq[i]; first.second = i; } } if(first.second==-1){ first.first = 1; first.second = 0; } int cur[n]; for(int i = 1; i<=n; i++){ int pos = (i-first.first+first.second+n+n)%n; cur[pos] = i; } vector<pair<int, int> > final; for(int i = 0; i<n; i++){ final.push_back(make_pair(gondolaSeq[i],i)); } sort(final.begin(),final.end()); int point = n+1; int p = 0; for(int i = 0; i<n; i++){ while(point<=final[i].first){ replacementSeq[p++] = cur[final[i].second]; cur[final[i].second] = point++; } } return p; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 508 KB | Output is correct |
5 | Correct | 2 ms | 508 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 636 KB | Output is correct |
2 | Correct | 2 ms | 640 KB | Output is correct |
3 | Correct | 2 ms | 640 KB | Output is correct |
4 | Correct | 2 ms | 640 KB | Output is correct |
5 | Correct | 2 ms | 640 KB | Output is correct |
6 | Correct | 19 ms | 2480 KB | Output is correct |
7 | Correct | 38 ms | 4024 KB | Output is correct |
8 | Correct | 27 ms | 4184 KB | Output is correct |
9 | Correct | 10 ms | 4184 KB | Output is correct |
10 | Correct | 35 ms | 4836 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4836 KB | Output is correct |
2 | Correct | 3 ms | 4836 KB | Output is correct |
3 | Correct | 2 ms | 4836 KB | Output is correct |
4 | Correct | 2 ms | 4836 KB | Output is correct |
5 | Correct | 2 ms | 4836 KB | Output is correct |
6 | Correct | 16 ms | 4836 KB | Output is correct |
7 | Correct | 39 ms | 4836 KB | Output is correct |
8 | Correct | 30 ms | 4836 KB | Output is correct |
9 | Correct | 10 ms | 4836 KB | Output is correct |
10 | Correct | 40 ms | 4836 KB | Output is correct |
11 | Correct | 3 ms | 4836 KB | Output is correct |
12 | Correct | 2 ms | 4836 KB | Output is correct |
13 | Correct | 21 ms | 4836 KB | Output is correct |
14 | Correct | 3 ms | 4836 KB | Output is correct |
15 | Correct | 53 ms | 5108 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 5108 KB | Output is correct |
2 | Correct | 2 ms | 5108 KB | Output is correct |
3 | Correct | 2 ms | 5108 KB | Output is correct |
4 | Correct | 3 ms | 5108 KB | Output is correct |
5 | Correct | 2 ms | 5108 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 5108 KB | Output is correct |
2 | Correct | 2 ms | 5108 KB | Output is correct |
3 | Correct | 2 ms | 5108 KB | Output is correct |
4 | Correct | 2 ms | 5108 KB | Output is correct |
5 | Correct | 2 ms | 5108 KB | Output is correct |
6 | Correct | 2 ms | 5108 KB | Output is correct |
7 | Correct | 2 ms | 5108 KB | Output is correct |
8 | Correct | 3 ms | 5108 KB | Output is correct |
9 | Correct | 2 ms | 5108 KB | Output is correct |
10 | Correct | 4 ms | 5108 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5108 KB | Output is correct |
2 | Correct | 2 ms | 5108 KB | Output is correct |
3 | Correct | 3 ms | 5108 KB | Output is correct |
4 | Correct | 2 ms | 5108 KB | Output is correct |
5 | Correct | 2 ms | 5108 KB | Output is correct |
6 | Correct | 2 ms | 5108 KB | Output is correct |
7 | Correct | 2 ms | 5108 KB | Output is correct |
8 | Correct | 2 ms | 5108 KB | Output is correct |
9 | Correct | 3 ms | 5108 KB | Output is correct |
10 | Correct | 3 ms | 5108 KB | Output is correct |
11 | Correct | 17 ms | 5108 KB | Output is correct |
12 | Correct | 19 ms | 5108 KB | Output is correct |
13 | Correct | 18 ms | 5108 KB | Output is correct |
14 | Correct | 16 ms | 5108 KB | Output is correct |
15 | Correct | 22 ms | 5108 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 5108 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 5108 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 5108 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 5108 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |