# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
288050 |
2020-09-01T08:17:36 Z |
AKaan37 |
Gondola (IOI14_gondola) |
C++17 |
|
13 ms |
2336 KB |
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair< lo,lo > PII;
#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
int n,m,b[li],k,flag=-1,t,c[li];
int cev;
string s;
vector<int> v;
int valid(int n, int a[]){
for(int i=0;i<n;i++){
if(a[i]<=n){
//~ cout<<a[i]-i<<endl;
int at=0;
if(a[i]>i+1)at=i+1+(n-a[i]);
else at=(i+1)-a[i];
//~ cout<<at<<endl;
if(flag==-1){
flag=at;
}
else{
if(flag!=at)return 0;
}
}
}
return 1;
}
int replacement(int n, int a[], int replacementSeq[]){
int mx=0,ind=0,yes=0;
memset(b,-1,sizeof(b));
for(int i=0;i<n;i++){
if(a[i]>mx)ind=i;
mx=max(mx,a[i]);
b[a[i]]=i;
if(a[i]<=n)yes=i;
}
int len=0;
int say=a[yes];
for(int i=yes;i<n;i++){
c[i]=(say)%n;
say++;
}
for(int i=0;i<yes;i++){
c[i]=(say)%n;
say++;
}
for(int i=n+1;i<=mx;i++){
if(~b[i]){replacementSeq[len++]=c[b[i]];c[b[i]]=i;}
else{replacementSeq[len++]=c[ind];c[ind]=i;}
}
return len;
}
int countReplacement(int n, int inputSeq[]){
return -3;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
308 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
512 KB |
Output is correct |
7 |
Correct |
12 ms |
640 KB |
Output is correct |
8 |
Correct |
10 ms |
640 KB |
Output is correct |
9 |
Correct |
3 ms |
384 KB |
Output is correct |
10 |
Correct |
11 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
512 KB |
Output is correct |
7 |
Correct |
12 ms |
672 KB |
Output is correct |
8 |
Correct |
9 ms |
640 KB |
Output is correct |
9 |
Correct |
3 ms |
384 KB |
Output is correct |
10 |
Correct |
13 ms |
640 KB |
Output is correct |
11 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2304 KB |
Output is correct |
2 |
Correct |
2 ms |
2304 KB |
Output is correct |
3 |
Correct |
1 ms |
2304 KB |
Output is correct |
4 |
Correct |
2 ms |
2304 KB |
Output is correct |
5 |
Correct |
1 ms |
2304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
2 ms |
2336 KB |
Output is correct |
6 |
Incorrect |
2 ms |
2304 KB |
Integer 0 violates the range [1, 5] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2304 KB |
Output is correct |
2 |
Correct |
2 ms |
2336 KB |
Output is correct |
3 |
Correct |
2 ms |
2304 KB |
Output is correct |
4 |
Correct |
2 ms |
2304 KB |
Output is correct |
5 |
Correct |
2 ms |
2304 KB |
Output is correct |
6 |
Incorrect |
1 ms |
2304 KB |
Integer 0 violates the range [1, 5] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |