#include "gondola.h"
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rt insert
#define st first
#define nd second
#define ll long long
#define pii pair < int , int >
#define DB printf("debug\n");
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define all(x) x.begin() , x.end()
using namespace std;
int nx(int i,int sz){
return (i+1)%(sz);
}
map < int,int > timesseen;
int valid(int n, int inputSeq[])
{
vector < int > orig;
for(int i=0;i<n;i++){
int nxx=nx(i,n);
timesseen[inputSeq[i]]++;
if(timesseen[inputSeq[i]]>1)return 0;
if(inputSeq[i]<=n)orig.pb(inputSeq[i]);
if(inputSeq[i]<=n&&inputSeq[nxx]<=n){
if(inputSeq[i]==n && inputSeq[nxx]!=1)return 0;
else if(inputSeq[i]<n && inputSeq[nxx]!=inputSeq[i]+1)return 0;
}
}
int startover=0;
for(int i=0;i<orig.size();i++){
int nxx=nx(i,orig.size());
if(orig[i]<orig[nxx])continue;
else if(startover==0)startover++;
else if(startover==1)return 0;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
Compilation message
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:33:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<orig.size();i++){
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3392 KB |
Output is correct |
2 |
Correct |
0 ms |
3392 KB |
Output is correct |
3 |
Correct |
0 ms |
3392 KB |
Output is correct |
4 |
Correct |
0 ms |
3392 KB |
Output is correct |
5 |
Correct |
0 ms |
3392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3392 KB |
Output is correct |
2 |
Correct |
0 ms |
3392 KB |
Output is correct |
3 |
Correct |
0 ms |
3392 KB |
Output is correct |
4 |
Correct |
0 ms |
3392 KB |
Output is correct |
5 |
Correct |
0 ms |
3392 KB |
Output is correct |
6 |
Correct |
16 ms |
5396 KB |
Output is correct |
7 |
Correct |
19 ms |
3392 KB |
Output is correct |
8 |
Correct |
33 ms |
7236 KB |
Output is correct |
9 |
Correct |
9 ms |
4608 KB |
Output is correct |
10 |
Correct |
39 ms |
7764 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3392 KB |
Output is correct |
2 |
Correct |
0 ms |
3392 KB |
Output is correct |
3 |
Correct |
0 ms |
3392 KB |
Output is correct |
4 |
Correct |
0 ms |
3392 KB |
Output is correct |
5 |
Correct |
0 ms |
3392 KB |
Output is correct |
6 |
Correct |
16 ms |
5396 KB |
Output is correct |
7 |
Correct |
13 ms |
3392 KB |
Output is correct |
8 |
Correct |
29 ms |
7236 KB |
Output is correct |
9 |
Correct |
9 ms |
4608 KB |
Output is correct |
10 |
Correct |
43 ms |
7764 KB |
Output is correct |
11 |
Correct |
0 ms |
3392 KB |
Output is correct |
12 |
Correct |
0 ms |
3392 KB |
Output is correct |
13 |
Correct |
16 ms |
4580 KB |
Output is correct |
14 |
Correct |
0 ms |
3392 KB |
Output is correct |
15 |
Correct |
13 ms |
3392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
3392 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
3392 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
3392 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
3392 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
3392 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
3392 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
3392 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |