Submission #1124503

#TimeUsernameProblemLanguageResultExecution timeMemory
1124503SalihSahinGondola (IOI14_gondola)C++20
20 / 100
40 ms4936 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; #include "gondola.h" int valid(int n, int inputSeq[]) { int ind = -1; for(int i = 0; i < n; i++){ if(inputSeq[i] <= n) ind = i; } if(ind == -1){ bool ok = 1; map<int, int> vis; for(int i = 0; i < n; i++){ if(vis[inputSeq[i]]) ok = 0; vis[inputSeq[i]] = 1; } return ok; } vector<int> alternate(n); for(int i = ind; i < n; i++){ alternate[i] = inputSeq[ind] + (i - ind); if(alternate[i] > n) alternate[i] -= n; } for(int i = 0; i < ind; i++){ alternate[i] = alternate[n-1] + i + 1; if(alternate[i] > n) alternate[i] -= n; } bool ok = 1; map<int, int> vis; for(int i = 0; i < n; i++){ if(vis[inputSeq[i]]) ok = 0; vis[inputSeq[i]] = 1; if(inputSeq[i] > n || inputSeq[i] == alternate[i]) continue; ok = 0; } return ok; } //---------------------- 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...