# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
52098 | 2018-06-23T22:16:09 Z | spencercompton | 곤돌라 (IOI14_gondola) | C++17 | 48 ms | 4988 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)); } 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 | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 468 KB | Output is correct |
3 | Correct | 2 ms | 468 KB | Output is correct |
4 | Correct | 2 ms | 468 KB | Output is correct |
5 | Correct | 2 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 512 KB | Output is correct |
6 | Correct | 20 ms | 2304 KB | Output is correct |
7 | Correct | 37 ms | 3840 KB | Output is correct |
8 | Correct | 28 ms | 4096 KB | Output is correct |
9 | Correct | 11 ms | 4096 KB | Output is correct |
10 | Correct | 34 ms | 4744 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4744 KB | Output is correct |
2 | Correct | 2 ms | 4744 KB | Output is correct |
3 | Correct | 2 ms | 4744 KB | Output is correct |
4 | Correct | 2 ms | 4744 KB | Output is correct |
5 | Correct | 2 ms | 4744 KB | Output is correct |
6 | Correct | 16 ms | 4744 KB | Output is correct |
7 | Correct | 37 ms | 4744 KB | Output is correct |
8 | Correct | 28 ms | 4744 KB | Output is correct |
9 | Correct | 9 ms | 4744 KB | Output is correct |
10 | Correct | 35 ms | 4816 KB | Output is correct |
11 | Correct | 2 ms | 4816 KB | Output is correct |
12 | Correct | 2 ms | 4816 KB | Output is correct |
13 | Correct | 20 ms | 4816 KB | Output is correct |
14 | Correct | 2 ms | 4816 KB | Output is correct |
15 | Correct | 48 ms | 4988 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4988 KB | Output is correct |
2 | Correct | 2 ms | 4988 KB | Output is correct |
3 | Correct | 2 ms | 4988 KB | Output is correct |
4 | Correct | 2 ms | 4988 KB | Output is correct |
5 | Correct | 2 ms | 4988 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4988 KB | Output is correct |
2 | Correct | 2 ms | 4988 KB | Output is correct |
3 | Correct | 3 ms | 4988 KB | Output is correct |
4 | Correct | 2 ms | 4988 KB | Output is correct |
5 | Correct | 2 ms | 4988 KB | Output is correct |
6 | Correct | 2 ms | 4988 KB | Output is correct |
7 | Incorrect | 2 ms | 4988 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4988 KB | Output is correct |
2 | Correct | 2 ms | 4988 KB | Output is correct |
3 | Correct | 2 ms | 4988 KB | Output is correct |
4 | Correct | 1 ms | 4988 KB | Output is correct |
5 | Correct | 2 ms | 4988 KB | Output is correct |
6 | Correct | 2 ms | 4988 KB | Output is correct |
7 | Incorrect | 3 ms | 4988 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 4988 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 4988 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 4988 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 4988 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |