# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
103571 | 2019-03-31T14:53:37 Z | SecretAgent007 | 곤돌라 (IOI14_gondola) | C++17 | 82 ms | 4728 KB |
#include "gondola.h" #include <bits/stdc++.h> using namespace std; int valid(int n, int inputSeq[]){ int index = 0; int num = n; map< int, bool> visited; for(int i = 0; i < n; i++){ if(visited[inputSeq[i]]) return 0; visited[inputSeq[i]] = true; if(inputSeq[i] <= num){ num = inputSeq[i]; index = i; } } int start = (index-num+1+n)%n; int curr = 1; for(int i = start; i < n; i++){ if(inputSeq[i] <= n && inputSeq[i] != curr) return 0; curr++; } for(int j = 0; j < start; j++){ if(inputSeq[j] <= n && inputSeq[j] != curr) return 0; curr++; } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]){ int index = 0; int num = n; int maxi = 0; for(int i = 0; i < n; i++){ if(gondolaSeq[i] <= num){ num = gondolaSeq[i]; index = i; } maxi = max(maxi, gondolaSeq[i]); } int start = (index-num+1+n)%n; if(gondolaSeq[index] > n) start = 0; int curr = 1; map<int, int> mape; int in; for(int i = start; i < n; i++){ mape[gondolaSeq[i]] = curr; if(gondolaSeq[i] == maxi) in = curr; curr++; } for(int j = 0; j < start; j++){ mape[gondolaSeq[j]] = curr; if(gondolaSeq[j] == maxi) in = curr; curr++; } int c = 0; for(int i = n+1; i <= maxi; i++){ if(mape[i] != 0){ replacementSeq[c] = mape[i]; }else{ replacementSeq[c] = in; } c++; } return c; } int countReplacement(int n, int inputSeq[]){ } /* int main(){ int n; cin >> n; int v[n]; int maxi = 0; for(int i = 0; i < n; i++){ cin >> v[i]; maxi = max(maxi, v[i]); } int ans[maxi-n]; cout << replacement(n,v,ans) << endl; for(int a : ans){ cout << a << ' '; } cout << endl; }*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 19 ms | 2304 KB | Output is correct |
7 | Correct | 18 ms | 776 KB | Output is correct |
8 | Correct | 33 ms | 3956 KB | Output is correct |
9 | Correct | 12 ms | 1536 KB | Output is correct |
10 | Correct | 46 ms | 4600 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 18 ms | 2304 KB | Output is correct |
7 | Correct | 19 ms | 768 KB | Output is correct |
8 | Correct | 30 ms | 3932 KB | Output is correct |
9 | Correct | 11 ms | 1536 KB | Output is correct |
10 | Correct | 41 ms | 4608 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Correct | 23 ms | 2048 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 82 ms | 4728 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Incorrect | 2 ms | 256 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Incorrect | 2 ms | 512 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |