# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67209 | 2018-08-13T15:53:38 Z | MKopchev | Gondola (IOI14_gondola) | C++14 | 54 ms | 9360 KB |
#include<bits/stdc++.h> #include "gondola.h" using namespace std; int valid(int n, int inputSeq[]) { set<int> uniq={}; for(int i=0;i<n;i++) uniq.insert(inputSeq[i]); if(uniq.size()!=n)return 0; int mini=0; for(int i=1;i<n;i++) if(inputSeq[mini]>inputSeq[i])mini=i; int ind=(mini+1)%n; int value=-1; int target=inputSeq[mini]; while(ind!=mini) { value=inputSeq[ind]; target++; if(value<target)return 0; if(value<=n&&target<=n) { if(value!=target)return 0; } ind=(ind+1)%n; } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { int mini=0; for(int i=1;i<n;i++) if(gondolaSeq[mini]>gondolaSeq[i])mini=i; map<int/*number you are aiming at*/,int/*where you begin*/> start={}; if(gondolaSeq[mini]>n) { for(int i=0;i<n;i++) start[gondolaSeq[i]]=i+1; } else { int value=gondolaSeq[mini],t=0; for(int i=mini;i!=mini||t==0;i=(i+1)%n) { start[gondolaSeq[i]]=value; value++; if(value>n)value=1; t++; } } int prev=-1,ind=0; //for(auto k:start)cout<<k.first<<" "<<k.second<<endl; for(auto k:start) { if(k.first!=k.second) { replacementSeq[ind++]=k.second; if(prev==-1)prev=k.second; else prev++; while(prev!=k.first) { replacementSeq[ind++]=prev; prev++; } } prev=k.first; } //cout<<ind<<" : ";for(int i=0;i<ind;i++)cout<<replacementSeq[i]<<" ";cout<<endl; return ind; } int countReplacement(int n, int inputSeq[]) { return -1; } /* int n=7; int v[]={2, 3, 4, 9, 6, 7, 1} ; int arr[7]; int main() { cout<<replacement(n,v,arr)<<endl; } */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 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 | 492 KB | Output is correct |
5 | Correct | 2 ms | 528 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 532 KB | Output is correct |
2 | Correct | 2 ms | 660 KB | Output is correct |
3 | Correct | 3 ms | 660 KB | Output is correct |
4 | Correct | 2 ms | 660 KB | Output is correct |
5 | Correct | 2 ms | 660 KB | Output is correct |
6 | Correct | 17 ms | 2744 KB | Output is correct |
7 | Correct | 40 ms | 4628 KB | Output is correct |
8 | Correct | 29 ms | 5260 KB | Output is correct |
9 | Correct | 10 ms | 5260 KB | Output is correct |
10 | Correct | 36 ms | 6512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 6512 KB | Output is correct |
2 | Correct | 2 ms | 6512 KB | Output is correct |
3 | Correct | 2 ms | 6512 KB | Output is correct |
4 | Correct | 2 ms | 6512 KB | Output is correct |
5 | Correct | 2 ms | 6512 KB | Output is correct |
6 | Correct | 16 ms | 6512 KB | Output is correct |
7 | Correct | 42 ms | 6512 KB | Output is correct |
8 | Correct | 29 ms | 7100 KB | Output is correct |
9 | Correct | 10 ms | 7100 KB | Output is correct |
10 | Correct | 36 ms | 8272 KB | Output is correct |
11 | Correct | 2 ms | 8272 KB | Output is correct |
12 | Correct | 2 ms | 8272 KB | Output is correct |
13 | Correct | 23 ms | 8272 KB | Output is correct |
14 | Correct | 2 ms | 8272 KB | Output is correct |
15 | Correct | 54 ms | 9360 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 9360 KB | Output is correct |
2 | Correct | 2 ms | 9360 KB | Output is correct |
3 | Correct | 2 ms | 9360 KB | Output is correct |
4 | Correct | 2 ms | 9360 KB | Output is correct |
5 | Correct | 3 ms | 9360 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 9360 KB | Output is correct |
2 | Correct | 2 ms | 9360 KB | Output is correct |
3 | Correct | 2 ms | 9360 KB | Output is correct |
4 | Correct | 2 ms | 9360 KB | Output is correct |
5 | Correct | 2 ms | 9360 KB | Output is correct |
6 | Incorrect | 2 ms | 9360 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 9360 KB | Output is correct |
2 | Correct | 3 ms | 9360 KB | Output is correct |
3 | Correct | 2 ms | 9360 KB | Output is correct |
4 | Correct | 2 ms | 9360 KB | Output is correct |
5 | Correct | 2 ms | 9360 KB | Output is correct |
6 | Incorrect | 3 ms | 9360 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 9360 KB | Integer -1 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 9360 KB | Integer -1 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 9360 KB | Integer -1 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 9360 KB | Integer -1 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |