Submission #389135

#TimeUsernameProblemLanguageResultExecution timeMemory
389135apostoldaniel854Gondola (IOI14_gondola)C++14
10 / 100
14 ms1100 KiB
#include <bits/stdc++.h> using namespace std; //#define HOME #ifndef HOME #include "gondola.h" #endif // HOME int valid(int n, int inputSeq[]) { int mn = 0; for (int i = 0; i < n; i++) if (inputSeq[i] < inputSeq[mn]) mn = i; rotate (inputSeq, inputSeq + mn, inputSeq + n); int cur = 0; for (int i = 0; i < n; i++) if (inputSeq[i] <= n) { if (cur < inputSeq[i]) cur = inputSeq[i]; else return 0; } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; } #ifdef HOME int gondolaSequence[100001]; int replacementSequence[250001]; int main() { int i, n, tag; int nr; assert(scanf("%d", &tag)==1); assert(scanf("%d", &n)==1); for(i=0;i< n;i++) assert( scanf("%d", &gondolaSequence[i]) ==1); switch (tag){ case 1: case 2: case 3: printf("%d\n", valid(n, gondolaSequence)); break; case 4: case 5: case 6: nr = replacement(n, gondolaSequence, replacementSequence); printf("%d ", nr); if (nr > 0) { for (i=0; i<nr-1; i++) printf("%d ", replacementSequence[i]); printf("%d\n", replacementSequence[nr-1]); } else printf("\n"); break; case 7: case 8: case 9: case 10: printf("%d\n", countReplacement(n, gondolaSequence)); break; } return 0; } #endif // HOME /** 1 30 16 26 18 19 20 13 22 21 24 25 17 27 28 29 30 1 2 3 11 5 6 8 7 9 10 12 4 23 14 15 2 6 3 4 5 6 1 2 **/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...