Submission #1088534

#TimeUsernameProblemLanguageResultExecution timeMemory
1088534T0p_Gondola (IOI14_gondola)C++14
20 / 100
16 ms2800 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std; int valid(int n, int inputSeq[]) { set<int> checked; vector<pair<int, int>> v; for (int i=0 ; i<n ; i++) { if (inputSeq[i] <= n) { v.push_back({ inputSeq[i], i }); } else { auto pos = checked.find(inputSeq[i]); if (pos != checked.end()) { return 0; } checked.insert(inputSeq[i]); } } sort(v.begin(), v.end()); int sz_v = v.size(); for (int i=0 ; i<sz_v-1 ; i++) { if (v[i].first == v[i+1].first) { return 0; } if ((v[i].second + v[i+1].first - v[i].first) % n != v[i+1].second) { 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...