Submission #403857

#TimeUsernameProblemLanguageResultExecution timeMemory
403857IwanttobreakfreeGondola (IOI14_gondola)C++98
0 / 100
1 ms204 KiB
#include "gondola.h" #include <vector> using namespace std; int valid(int n, int inputSeq[]){ int mini=1e9,pos,cont=0; for(int i=0;i<n;i++){ if(inputSeq[i]<mini){ mini=inputSeq[i]; pos=i; } } vector<int>v(n); for(int i=pos;i<n;i++){ v[cont]=inputSeq[i]; cont++; } for(int i=0;i<pos;i++){ v[cont]=inputSeq[i]; cont++; } for(int i=0;i<n;i++){ if(v[i]>n)continue; if(v[i]-mini!=pos)return 0; } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]){ return -2; } int countReplacement(int n, int inputSeq[]){ return -3; }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:18:11: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |    v[cont]=inputSeq[i];
#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...