Submission #232071

#TimeUsernameProblemLanguageResultExecution timeMemory
232071anonymousGondola (IOI14_gondola)C++14
20 / 100
18 ms1408 KiB
#include "gondola.h" #include <vector> #include <iostream> #define MAXN 100005 #define MAXV 250005 using namespace std; int valid(int n, int Seq[]) { bool has[MAXV]={}, b = false; int pos, v; for (int i=0; i<n; i++) { if (Seq[i] <= n) { pos = i; v = Seq[i]; } if (has[Seq[i]]) {return(0);} has[Seq[i]]=true; } for (int i=0; i<n; i++) { if (Seq[pos] > n) {} else if (Seq[pos] != v) {return(0);} pos = (pos+1) %n; v= v == n ? 1 : v+1; } 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:10:22: warning: unused variable 'b' [-Wunused-variable]
   bool has[MAXV]={}, b = false;
                      ^
gondola.cpp:25:15: warning: 'v' may be used uninitialized in this function [-Wmaybe-uninitialized]
     v= v == n ? 1 : v+1;
        ~~~~~~~^~~~~~~~~
gondola.cpp:22:16: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (Seq[pos] > n) {}
                ^
#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...