#include <bits/stdc++.h>
#include <gondola.h>
using namespace std;
int valid(int n, int inputSeq[]) {
int done[250001] = {};
vector<int> a;
int check = 1;
for (int i = 0; i < n; i++) {
done[inputSeq[i]]++;
if (done[inputSeq[i]] > 1)
check = 0;
if (inputSeq[i] <= n)
a.push_back(inputSeq[i]);
}
int pos = -1, val = n + 1;
for (int i = 0; i < a.size(); i++) {
if (a[i] < val)
val = a[i], pos = i;
}
for (int i = 0, j = pos + 1; i < a.size() - 1; i++, j++) {
if (j == a.size())
j = 0;
if (a[j] <= val)
check = 0;
val = a[j];
}
return check;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
return 1;
}
int countReplacement(int n, int inputSeq[]) {
return 1;
}
/*int gondolaSequence[100001];
int replacementSequence[250001];
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;
}*/
Compilation message
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:18:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < a.size(); i++) {
~~^~~~~~~~~~
gondola.cpp:23:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0, j = pos + 1; i < a.size() - 1; i++, j++) {
~~^~~~~~~~~~~~~~
gondola.cpp:24:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (j == a.size())
~~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1272 KB |
Output is correct |
2 |
Correct |
3 ms |
1272 KB |
Output is correct |
3 |
Correct |
3 ms |
1272 KB |
Output is correct |
4 |
Correct |
8 ms |
1400 KB |
Output is correct |
5 |
Correct |
3 ms |
1272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1276 KB |
Output is correct |
2 |
Correct |
4 ms |
1272 KB |
Output is correct |
3 |
Correct |
3 ms |
1272 KB |
Output is correct |
4 |
Correct |
3 ms |
1272 KB |
Output is correct |
5 |
Correct |
3 ms |
1276 KB |
Output is correct |
6 |
Correct |
8 ms |
2040 KB |
Output is correct |
7 |
Correct |
16 ms |
2832 KB |
Output is correct |
8 |
Correct |
13 ms |
2676 KB |
Output is correct |
9 |
Correct |
6 ms |
1784 KB |
Output is correct |
10 |
Correct |
14 ms |
2676 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1272 KB |
Output is correct |
2 |
Correct |
3 ms |
1272 KB |
Output is correct |
3 |
Correct |
3 ms |
1272 KB |
Output is correct |
4 |
Correct |
3 ms |
1272 KB |
Output is correct |
5 |
Correct |
3 ms |
1272 KB |
Output is correct |
6 |
Correct |
8 ms |
2040 KB |
Output is correct |
7 |
Correct |
16 ms |
2804 KB |
Output is correct |
8 |
Correct |
13 ms |
2676 KB |
Output is correct |
9 |
Correct |
6 ms |
1784 KB |
Output is correct |
10 |
Correct |
14 ms |
2804 KB |
Output is correct |
11 |
Correct |
3 ms |
1272 KB |
Output is correct |
12 |
Incorrect |
3 ms |
1272 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
252 KB |
Integer 0 violates the range [1, 76] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
252 KB |
Integer 0 violates the range [1, 76] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Integer 0 violates the range [1, 76] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
8 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |