#include<bits/stdc++.h>
using namespace std;
int query(int a, int b, int c, int d);
int solve(int n, int* l, int* r){
for(int i=0;i<n;i++)l[i]=r[i]=-1;
vector<int>chain{0};
for(int i=1;i<n;i++){
int last=-1;
while(chain.size()){
int res=query(chain.back(),chain.back(),chain.back(),i);
if(res==1){
r[chain.back()]=i;
break;
}else{
last=chain.back();
chain.pop_back();
}
}
l[i]=last;
chain.push_back(i);
}
return chain[0];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
344 KB |
Output is correct |
3 |
Correct |
5 ms |
344 KB |
Output is correct |
4 |
Correct |
6 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
66 ms |
428 KB |
Output is correct |
2 |
Correct |
63 ms |
428 KB |
Output is correct |
3 |
Correct |
43 ms |
596 KB |
Output is correct |
4 |
Correct |
55 ms |
676 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
64 ms |
672 KB |
Output is correct |
2 |
Correct |
44 ms |
676 KB |
Output is correct |
3 |
Correct |
38 ms |
676 KB |
Output is correct |
4 |
Correct |
67 ms |
668 KB |
Output is correct |