Submission #788800

#TimeUsernameProblemLanguageResultExecution timeMemory
788800acatmeowmeowGondola (IOI14_gondola)C++11
20 / 100
37 ms5164 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std; int valid(int n, int inputSeq[]) { ios::sync_with_stdio(false); cin.tie(nullptr); set<int> st; for (int i = 0; i < n; i++) { if (st.count(inputSeq[i])) return 0; st.insert(inputSeq[i]); } int lowest = 1e9, pos = 1e9; for (int i = 0; i < n; i++) { if (lowest > inputSeq[i]) { lowest = inputSeq[i], pos = i; } } if (lowest > n) return 1; for (int i = pos, cnt = lowest, len = 1; len <= n; i = (i + 1) % n, len++, cnt = cnt % n + 1) { if (inputSeq[i] > n) continue; if (cnt != inputSeq[i]) return 0; } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; } /*int gondolaSequence[100001]; int replacementSequence[250001]; signed main() { int i, n, tag; int nr; //assert(scanf("%d", &tag)==1); //assert(scanf("%d", &n)==1); cin >> tag >> n; for(i=0;i< n;i++) cin >> gondolaSequence[i]; //assert( scanf("%d", &gondolaSequence[i]) ==1); switch (tag){ case 1: case 2: case 3: printf("%d\n", valid(n, gondolaSequence)); break; case 4: case 5: case 6: nr = replacement(n, gondolaSequence, replacementSequence); printf("%d ", nr); if (nr > 0) { for (i=0; i<nr-1; i++) printf("%d ", replacementSequence[i]); printf("%d\n", replacementSequence[nr-1]); } else printf("\n"); break; case 7: case 8: case 9: case 10: printf("%d\n", countReplacement(n, gondolaSequence)); break; } return 0; }*/
#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...