Submission #1088539

#TimeUsernameProblemLanguageResultExecution timeMemory
1088539T0p_Gondola (IOI14_gondola)C++14
20 / 100
17 ms2772 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[]) { int l = 0; for (int i=0 ; i<n ; i++) { if (gondolaSeq[i] > n) { replacementSeq[l++] = gondolaSeq[i]; } } return l; } //---------------------- 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...