#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn=300000+10;
vector<int>c(maxn),x(maxn),y(maxn);
int lnk[maxn],s;
void adde(int u,int v){
s++;
x[s]=y[s]=-s;
if(lnk[u]==0){
c[u]=-s;
y[s]=v;
lnk[u]=s;
return ;
}
swap(x[lnk[u]],y[lnk[u]]);
y[lnk[u]]=-s;
lnk[u]=s;
y[s]=v;
}
void create_circuit(int M, std::vector<int> A) {
int n = A.size();
s=0;
int now=0;
for(int i=0;i<n;i++){
adde(now,A[i]);
now=A[i];
}
adde(now,0);
c.resize(M+1);
for(int i=0;i<s;i++){
x[i]=x[i+1];
y[i]=y[i+1];
}
x.resize(s);
y.resize(s);
/* for(auto i:c){
cout<<i<<" ";
}
cout<<endl;
for(auto i:x){
cout<<i<<" ";
}
cout<<endl;
for(auto i:y){
cout<<i<<" ";
}
cout<<endl;*/
answer(c, x, y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3928 KB |
Output is correct |
2 |
Correct |
18 ms |
6672 KB |
Output is correct |
3 |
Correct |
24 ms |
6728 KB |
Output is correct |
4 |
Correct |
2 ms |
3932 KB |
Output is correct |
5 |
Correct |
10 ms |
4700 KB |
Output is correct |
6 |
Correct |
24 ms |
7732 KB |
Output is correct |
7 |
Incorrect |
2 ms |
3928 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3928 KB |
Output is correct |
2 |
Correct |
18 ms |
6672 KB |
Output is correct |
3 |
Correct |
24 ms |
6728 KB |
Output is correct |
4 |
Correct |
2 ms |
3932 KB |
Output is correct |
5 |
Correct |
10 ms |
4700 KB |
Output is correct |
6 |
Correct |
24 ms |
7732 KB |
Output is correct |
7 |
Incorrect |
2 ms |
3928 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3928 KB |
Output is correct |
2 |
Correct |
18 ms |
6672 KB |
Output is correct |
3 |
Correct |
24 ms |
6728 KB |
Output is correct |
4 |
Correct |
2 ms |
3932 KB |
Output is correct |
5 |
Correct |
10 ms |
4700 KB |
Output is correct |
6 |
Correct |
24 ms |
7732 KB |
Output is correct |
7 |
Incorrect |
2 ms |
3928 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
3928 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
3932 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
3932 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |