# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
961216 | 2024-04-11T17:33:39 Z | IUA_Hasin | 곤돌라 (IOI14_gondola) | C++17 | 1000 ms | 9804 KB |
#include "gondola.h" #include <bits/stdc++.h> #define endl "\n" #define yeap cout<<"YES"<<endl #define nope cout<<"NO"<<endl #define ll long long using namespace std; const ll N = 1e6; ll vis[N]; ll vec[N]; int valid(int n, int inputSeq[]) { ll mn = 300000; ll mx = -1; ll mnind = 0; ll status = 1; for(int i=0; i<n; i++){ ll a = inputSeq[i]; if(a<mn){ mn = a; mnind = i; } mx = max(mx, a); vis[a]++; if(vis[a]>1){ status = -1; } } // if((mx-mn)>=n){ // status = -1; // } if(status==-1){ return 0; } else { if(mn>=n){ return 1; } else { ll cnt = 0; ll ind = mnind; ll temp = mn; while(cnt<n){ ll temp1 = ind%n; if(inputSeq[temp1]<=n){ if(inputSeq[temp1]!=temp){ status = -1; break; } cnt++; ind++; temp++; } } if(status==-1){ return 0; } else { return 1; } } } } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { ll mx = -1; ll mn = 300000; for(int i=0; i<n; i++){ ll a = gondolaSeq[i]; vis[a] = 1; mx = max(mx, a); mn = min(mn, a); } if(mx==n){ return 0; } else { if(mn>n){ for(int i=0; i<n; i++){ ll a = gondolaSeq[i]; vec[a] = i+1; } ll cnt = 0; ll cnt1 = n; for(int i=n+1; i<=mx; i++){ ll b = vec[i]; if(vis[i]==1){ replacementSeq[cnt] = b; cnt++; cnt1++; while(cnt1<i){ replacementSeq[cnt] = cnt1; cnt++; cnt1++; } } } return cnt; } else { ll mnind; for(int i=0; i<n; i++){ if(gondolaSeq[i]==mn){ mnind = i; break; } } ll cntt = 0; ll temp1 = mn; ll temp2 = mnind; while(cntt<n){ ll a = temp1%n; ll b = temp2%n; ll c = gondolaSeq[b]; if(a==0){ a = n; } vec[c] = a; temp1++; temp2++; cntt++; } ll cnt = 0; ll cnt1 = n; for(int i=n+1; i<=mx; i++){ ll b = vec[i]; if(vis[i]==1){ replacementSeq[cnt] = b; cnt++; cnt1++; while(cnt1<i){ replacementSeq[cnt] = cnt1; cnt++; cnt1++; } } } return cnt; } } } //---------------------- int countReplacement(int n, int inputSeq[]) { ll status = valid(n, inputSeq); if(status==0){ return 0; } else { } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 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 | 0 ms | 444 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 | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 3 ms | 860 KB | Output is correct |
7 | Correct | 7 ms | 1880 KB | Output is correct |
8 | Correct | 9 ms | 1884 KB | Output is correct |
9 | Correct | 4 ms | 604 KB | Output is correct |
10 | Correct | 8 ms | 1884 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 448 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 3 ms | 1084 KB | Output is correct |
7 | Correct | 7 ms | 1884 KB | Output is correct |
8 | Correct | 6 ms | 1628 KB | Output is correct |
9 | Correct | 2 ms | 604 KB | Output is correct |
10 | Correct | 7 ms | 1680 KB | Output is correct |
11 | Correct | 0 ms | 352 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Execution timed out | 1014 ms | 2392 KB | Time limit exceeded |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Output is correct |
2 | Correct | 1 ms | 4440 KB | Output is correct |
3 | Correct | 1 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 2392 KB | Output is correct |
5 | Correct | 2 ms | 4444 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Output is correct |
2 | Correct | 1 ms | 4444 KB | Output is correct |
3 | Correct | 1 ms | 4440 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 4444 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 4568 KB | Output is correct |
8 | Correct | 2 ms | 4444 KB | Output is correct |
9 | Correct | 1 ms | 4444 KB | Output is correct |
10 | Correct | 1 ms | 4440 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Output is correct |
2 | Correct | 1 ms | 4444 KB | Output is correct |
3 | Correct | 1 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 2648 KB | Output is correct |
5 | Correct | 1 ms | 4440 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 4444 KB | Output is correct |
8 | Correct | 2 ms | 4440 KB | Output is correct |
9 | Correct | 1 ms | 4600 KB | Output is correct |
10 | Correct | 1 ms | 4440 KB | Output is correct |
11 | Correct | 7 ms | 5212 KB | Output is correct |
12 | Correct | 7 ms | 5212 KB | Output is correct |
13 | Correct | 12 ms | 9560 KB | Output is correct |
14 | Correct | 7 ms | 5448 KB | Output is correct |
15 | Correct | 17 ms | 9804 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1061 ms | 348 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1036 ms | 352 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1062 ms | 348 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1035 ms | 348 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |