Submission #430844

#TimeUsernameProblemLanguageResultExecution timeMemory
430844Rouge_HugoGondola (IOI14_gondola)C++14
25 / 100
15 ms1740 KiB
#include<bits/stdc++.h> #define ll long long #define fi first #define se second #define pb push_back #include "gondola.h" using namespace std; const int N=100090; int vis[250090],r[N],yes[N],a[N],don[N]; int mn=1e9,mx=0; int valid(int n, int A[]) { int w=0; for(int i=0; i<n; i++) a[i]=A[i]; for(int i=0; i<n; i++) yes[a[i]]=i; for(int i=0; i<n; i++) { if(vis[a[i]]) return 0; vis[a[i]]=1; mn=min(mn,a[i]); mx=max(mx,a[i]); if(mn==a[i]) w=i; } if(mn>=n) return 1; int x=mn; for(int i=w+1; i<n; i++) { x++; if(a[i]>n) { a[i]=x; continue; } if(a[i]!=x) return 0; } x=a[n-1]; for(int i=0; i<w; i++) { x++; if(a[i]>n) { a[i]=x; continue; } if(a[i]!=x) return 0; } return 1; } int replacement(int n, int a[], int r[]) { int w=0; for(int i=0; i<n; i++) yes[a[i]]=i; for(int i=0; i<n; i++) { mn=min(mn,a[i]); mx=max(mx,a[i]); if(mn==a[i]) w=i; } int x=mn; for(int i=w+1; i<n; i++) { x++; x%=n; if(x==0) x=1; a[i]=x; continue; } for(int i=0; i<w; i++) { x++; x%=n; if(x==0) x=1; a[i]=x; continue; } int u=0; if(mn>n) while(1) u++; if(mn>n) { for(int i=0; i<n; i++) a[i]=i+1; for(int i=0; i<n; i++) { yes[a[i]]=i+1; } } int last=0; for(int i=n+1; i<=mx; i++) { if(yes[i]==-1) { while(don[last]) last++; r[u]=a[last]; u++; a[last]=i; continue; } r[u]=a[yes[i]]; don[yes[i]]=1; u++; } return u; } int countReplacement(int n, int inputSeq[]) { return -3; }

Compilation message (stderr)

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:73:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   73 |         if(x==0)
      |         ^~
gondola.cpp:75:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   75 |             a[i]=x;
      |             ^
gondola.cpp:82:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   82 |         if(x==0)
      |         ^~
gondola.cpp:84:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   84 |             a[i]=x;
      |             ^
#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...