Submission #163467

#TimeUsernameProblemLanguageResultExecution timeMemory
163467ioaneGondola (IOI14_gondola)C++14
10 / 100
17 ms1528 KiB
#include "gondola.h"/**/ #include <bits/stdc++.h> #define LL long long #define PB push_back #define FOR(i,n) for (int i = 0; i < (n); i++) const LL N = 100005, NR = 250005; using namespace std; LL i, j, k, l, r, t; LL a[N]; bool fix[NR]; int valid(int n, int inputSeq[]){ t = NR; for ( i = 1; i <= n; ++i ){ if ( fix[inputSeq[i-1]] ) return 0; fix[inputSeq[i-1]] = 1; if ( inputSeq[i-1] <= n ){ t = inputSeq[i-1] - i; break; } } if ( t == NR ) return 1; for ( i = 1; i <= n; ++i ){ j = i + t; while ( j < 1 ) j += n; while ( j > n ) j -= n; a[j] = inputSeq[i-1]; } for ( i = 1; i <= n; ++i ){ if ( a[i] <= n && a[i] != i ) return 0; } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; } /*/ 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; } /**/

Compilation message (stderr)

gondola.cpp:93:1: warning: "/*" within comment [-Wcomment]
 /**/
#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...