제출 #62585

#제출 시각아이디문제언어결과실행 시간메모리
62585evpipis곤돌라 (IOI14_gondola)C++11
20 / 100
35 ms5320 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std; //#define TEST #ifdef TEST int gondolaSequence[100001]; int replacementSequence[250001]; #endif int valid(int n, int arr[]){ int pos = -1; for (int i = 0; i < n; i++) if (arr[i] <= n) pos = i; if (pos != -1){ int cur = arr[pos]; for (int i = 0; i < n; i++){ if (arr[pos] <= n && arr[pos] != cur) return 0; cur++; if (cur == n+1) cur = 1; pos = (pos+1)%n; } } sort(arr, arr+n); for (int i = 0; i < n-1; i++) if (arr[i] == arr[i+1]) return 0; return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; } #ifdef TEST int main() { int i, n, tag; int nr; assert(scanf("%d", &tag)==1); assert(scanf("%d", &n)==1); for(i=0;i< n;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; } #endif /* 3 5 10 4 3 11 12 3 7 2 3 4 9 6 7 1 */
#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...