Submission #297221

#TimeUsernameProblemLanguageResultExecution timeMemory
297221miss_robotGondola (IOI14_gondola)C++14
20 / 100
57 ms5240 KiB
#include <bits/stdc++.h> #include "gondola.h" #pragma GCC optimize("O3") using namespace std; int valid(int n, int inputSeq[]){ set<int> seen; for(int i = 0; i < n; i++){ if(seen.count(inputSeq[i])) return 0; seen.insert(inputSeq[i]); } int pos = -1, st; for(int i = 0; i < n; i++) if(inputSeq[i] <= n) pos = i, st = inputSeq[i]; if(pos == -1) return 1; for(int j = 0; j < n; j++, pos++, pos %= n){ if(inputSeq[pos] > n) continue; if(inputSeq[pos] != (st+j-1)%n+1) return 0; } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]){ } int countReplacement(int n, int inputSeq[]){ }

Compilation message (stderr)

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
   25 | }
      | ^
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:14:16: warning: 'st' may be used uninitialized in this function [-Wmaybe-uninitialized]
   14 |  int pos = -1, st;
      |                ^~
#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...