Submission #489287

#TimeUsernameProblemLanguageResultExecution timeMemory
489287QuantumK9Gondola (IOI14_gondola)C++17
20 / 100
30 ms4924 KiB
#include "gondola.h" #include <bits/stdc++.h> #define ll long long using namespace std; int valid(int n, int inputSeq[]){ ll mx = n; set<ll> memo; ll i = 0; ll expectedVal; while ( i < n ){ ll use = inputSeq[i]; i++; if ( memo.find(use) != memo.end() ){ return 0; } memo.insert( use ); mx = max( mx, use ); if ( use <= n ){ expectedVal = use; break; } } for ( ; i < n; i++ ){ expectedVal++; if( expectedVal > n ){ expectedVal -= n; } //cout << inputSeq[i] << " " << expectedVal << endl; ll use = inputSeq[i]; if ( use <= n ){ if ( use != expectedVal ){ return 0; } } if ( memo.find(use) != memo.end() ){ return 0; } memo.insert( use ); mx = max( mx, use ); } //for( ll j = n+1; j <= mx; j++ ){ if ( memo.find(j) == memo.end() ){ return 0; } } return 1; } //---------------------- 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...