Submission #918313

#TimeUsernameProblemLanguageResultExecution timeMemory
918313contest_altGondola (IOI14_gondola)C++17
20 / 100
11 ms1372 KiB
#include "gondola.h" #include <algorithm> #include <vector> int valid( int n, int inputSeq[] ) { int shift_min = n, shift_max = -1; std::vector<int> vals( n ); for( int i = 0 ; i < n ; i++ ){ if( inputSeq[i] > n ) continue; if( inputSeq[i] <= 0 ) return false; vals[i] = inputSeq[i]; int shift = (inputSeq[i] - 1 + n - i) % n; shift_min = std::min( shift_min, shift ); shift_max = std::max( shift_max, shift ); } std::sort( vals.begin(), vals.end() ); for( int i = 1 ; i < n ; i++ ) if( vals[i - 1] == vals[i] ) return false; if( shift_max < 0 ) return true; return shift_min == shift_max; } //---------------------- int replacement( int n, int gondolaSeq[], int replacementSeq[] ) { return -2; } //---------------------- int countReplacement( int n, int inputSeq[] ) { return -3; }
#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...