Submission #138686

#TimeUsernameProblemLanguageResultExecution timeMemory
138686zoooma13Gondola (IOI14_gondola)C++14
20 / 100
51 ms4624 KiB
#include "bits/stdc++.h" #include "gondola.h" using namespace std; int valid(int n, int inputSeq[]){ int mi_idx = min_element(inputSeq ,inputSeq+n)-inputSeq; set <int> ss; for(int i=0; i<n; i++) ss.insert(inputSeq[i]); if(ss.size() != n) return 0; if(inputSeq[mi_idx] >= n) return 1; int nxt = inputSeq[mi_idx]; for(int i=mi_idx; nxt<=n; i++){ if(inputSeq[i%n] != nxt && inputSeq[i%n] <= n) return 0; nxt++; } 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:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(ss.size() != 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...