///~~~LOTA~~~///
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define MAXN 250001
int vis[MAXN];
int valid(int n, int a[]){
for(int i=0;i<n;i++){
if(a[i]>n) continue;
vis[a[i]]=1;
for(int j=i+1;j<i+n;j++){
if(vis[a[j%n]]) return 0;
vis[a[j%n]]=1;
if(a[j%n]>n) continue;
if(a[j%n]!=1+((a[i]+j-i-1)%n)) return 0;
}
return 1;
}
for(int i=0;i<n;i++){
if(vis[a[i]]) return 0;
vis[a[i]]=1;
}
return 1;
}
int replacement(int n,int a[],int v[]){
int m,o;
set<pii> s;
for(int i=m=o=0;i<n;i++){
m=max(m,a[i]);
if(a[i]>n) continue;
for(int j=i+1;j<i+n;j++){
m=max(m,a[j%n]);
if(a[j%n]>n)
s.insert({a[j%n],1+((a[i]+j-i-1)%n)});
}
o=1;
break;
}
pii pi;
if(!o)
for(int i=0;i<n;i++)
s.insert({a[i],i+1});
o=0;
for(int i=n+1;i<=m;i++){
pi=*s.begin();
s.erase(s.begin());
v[o]=pi.ss;
pi.ss=i;
o++;
if(pi.ss!=pi.ff)
s.insert(pi);
}
return o;
}
int countReplacement(int n, int inputSeq[]){
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2500 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2492 KB |
Output is correct |
4 |
Correct |
1 ms |
2392 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
6 |
Correct |
3 ms |
2648 KB |
Output is correct |
7 |
Correct |
7 ms |
2908 KB |
Output is correct |
8 |
Correct |
6 ms |
2956 KB |
Output is correct |
9 |
Correct |
2 ms |
2652 KB |
Output is correct |
10 |
Correct |
7 ms |
3160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
2 ms |
2392 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
3 ms |
2860 KB |
Output is correct |
7 |
Correct |
11 ms |
2904 KB |
Output is correct |
8 |
Correct |
6 ms |
2908 KB |
Output is correct |
9 |
Correct |
2 ms |
2648 KB |
Output is correct |
10 |
Correct |
9 ms |
3160 KB |
Output is correct |
11 |
Correct |
1 ms |
2492 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
5 ms |
2608 KB |
Output is correct |
14 |
Correct |
1 ms |
2392 KB |
Output is correct |
15 |
Correct |
9 ms |
3012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
0 ms |
2488 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
2 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2400 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2392 KB |
Output is correct |
9 |
Correct |
2 ms |
2404 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
7 ms |
2908 KB |
Output is correct |
12 |
Correct |
8 ms |
3012 KB |
Output is correct |
13 |
Correct |
20 ms |
4500 KB |
Output is correct |
14 |
Correct |
6 ms |
2908 KB |
Output is correct |
15 |
Correct |
25 ms |
4296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |