# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
62585 |
2018-07-29T08:43:24 Z |
evpipis |
Gondola (IOI14_gondola) |
C++11 |
|
35 ms |
5320 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
496 KB |
Output is correct |
3 |
Correct |
2 ms |
496 KB |
Output is correct |
4 |
Correct |
3 ms |
516 KB |
Output is correct |
5 |
Correct |
3 ms |
516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
524 KB |
Output is correct |
2 |
Correct |
2 ms |
528 KB |
Output is correct |
3 |
Correct |
3 ms |
588 KB |
Output is correct |
4 |
Correct |
3 ms |
772 KB |
Output is correct |
5 |
Correct |
4 ms |
772 KB |
Output is correct |
6 |
Correct |
15 ms |
1052 KB |
Output is correct |
7 |
Correct |
20 ms |
1732 KB |
Output is correct |
8 |
Correct |
23 ms |
2128 KB |
Output is correct |
9 |
Correct |
11 ms |
2168 KB |
Output is correct |
10 |
Correct |
35 ms |
2804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2804 KB |
Output is correct |
2 |
Correct |
2 ms |
2804 KB |
Output is correct |
3 |
Correct |
3 ms |
2804 KB |
Output is correct |
4 |
Correct |
3 ms |
2804 KB |
Output is correct |
5 |
Correct |
3 ms |
2804 KB |
Output is correct |
6 |
Correct |
14 ms |
2804 KB |
Output is correct |
7 |
Correct |
19 ms |
3532 KB |
Output is correct |
8 |
Correct |
19 ms |
3908 KB |
Output is correct |
9 |
Correct |
11 ms |
3908 KB |
Output is correct |
10 |
Correct |
24 ms |
4584 KB |
Output is correct |
11 |
Correct |
2 ms |
4584 KB |
Output is correct |
12 |
Correct |
2 ms |
4584 KB |
Output is correct |
13 |
Correct |
8 ms |
4584 KB |
Output is correct |
14 |
Correct |
2 ms |
4584 KB |
Output is correct |
15 |
Correct |
20 ms |
5320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
5320 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
5320 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
5320 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
5320 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
5320 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
5320 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
5320 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |