#include <stdlib.h>
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int valid(int n, int a[])
{
int k[250000]={0};
int y[250000]={0},d=0;
for(int i=0;i<n;i++){
k[a[i]]++;
}
for(int i=0;i<n;i++){
if(k[a[i]]>1) return 0;
}
for(int i=0;i<n;i++){
if(a[i]<=n){
if(y[(a[i]-i+n)%n]==0) d++;
y[(a[i]-i+n)%n]++;
}
}
if(d<=1) return 1;
return 0;
}
//----------------------
int replacement(int n, int a[], int replacementSeq[])
{
int y[100000]={0};
for(int i=0;i<n;i++){
if(a[i]<=n){
y[(a[i]-i+n)%n]++;
}
}
int e=0;
for(int i=0;i<n;i++){
e=max(e,y[i]);
}
return n-e;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2304 KB |
Output is correct |
2 |
Correct |
1 ms |
2304 KB |
Output is correct |
3 |
Correct |
2 ms |
2304 KB |
Output is correct |
4 |
Correct |
1 ms |
2304 KB |
Output is correct |
5 |
Correct |
2 ms |
2304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2304 KB |
Output is correct |
2 |
Correct |
2 ms |
2304 KB |
Output is correct |
3 |
Correct |
2 ms |
2304 KB |
Output is correct |
4 |
Correct |
2 ms |
2304 KB |
Output is correct |
5 |
Correct |
1 ms |
2304 KB |
Output is correct |
6 |
Correct |
7 ms |
2432 KB |
Output is correct |
7 |
Correct |
15 ms |
2688 KB |
Output is correct |
8 |
Correct |
12 ms |
2560 KB |
Output is correct |
9 |
Correct |
5 ms |
2304 KB |
Output is correct |
10 |
Correct |
14 ms |
2560 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2304 KB |
Output is correct |
2 |
Correct |
2 ms |
2304 KB |
Output is correct |
3 |
Correct |
2 ms |
2304 KB |
Output is correct |
4 |
Correct |
2 ms |
2304 KB |
Output is correct |
5 |
Correct |
1 ms |
2304 KB |
Output is correct |
6 |
Correct |
7 ms |
2432 KB |
Output is correct |
7 |
Correct |
14 ms |
2560 KB |
Output is correct |
8 |
Correct |
14 ms |
2560 KB |
Output is correct |
9 |
Correct |
5 ms |
2304 KB |
Output is correct |
10 |
Correct |
14 ms |
2560 KB |
Output is correct |
11 |
Correct |
1 ms |
2304 KB |
Output is correct |
12 |
Correct |
2 ms |
2304 KB |
Output is correct |
13 |
Correct |
8 ms |
2432 KB |
Output is correct |
14 |
Correct |
1 ms |
2304 KB |
Output is correct |
15 |
Correct |
16 ms |
2560 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
768 KB |
Integer 0 violates the range [1, 76] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
768 KB |
Integer 0 violates the range [1, 76] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
800 KB |
Integer 0 violates the range [1, 76] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |