#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
//#define int long long int
using namespace std;
#include<library.h>
vector<int> Q(1001, 0);
int ind = 0;
int n;
vector<int> adj[1001];
int bin(int l, int r, int v, bool eq = true){
int ret = -1;
while(l <= r){
int mid = (l + r) / 2;
vector<int> arr(n, 0);
for(int i = 0; i <= mid; i++)arr[i] = 1;
for(int i = mid + 1; i < n; i++)arr[i] = 0;
arr[v] = 1;
if((eq && Query(arr) <= Q[mid]) || (!eq && Query(arr) < Q[mid])){
ret = mid;
r = mid - 1;
}
else{
l = mid + 1;
}
}
return ret;
}
void Solve(int N){
n = N;
vector<int> arr(n, 0);
for(;ind < n; ind++){
arr[ind] = 1;
Q[ind] = Query(arr);
if(ind != 0 && Q[ind] <= Q[ind - 1]){
int x = bin(0, ind - 1, ind, true);
adj[x].pb(ind);
adj[ind].pb(x);
x = bin(x + 1, ind - 1, ind, false);
if(x != -1){
adj[x].pb(ind);
adj[ind].pb(x);
}
}
}
int root = 0;
while(sz(adj[root]) == 2)root++;
vector<int> ans;
int x = root;
for(int i = 0; i < n; i++){
if(adj[x].size() == 1){
ans.pb(x);
x = adj[x][0];
}
else{
if(ans.back() == adj[x][0]){
ans.pb(x);
x = adj[x][1];
}
else{
ans.pb(x);
x = adj[x][0];
}
}
}
Answer(ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
556 KB |
Wrong Answer [5] |
2 |
Incorrect |
33 ms |
248 KB |
Wrong Answer [5] |
3 |
Incorrect |
35 ms |
248 KB |
Wrong Answer [5] |
4 |
Incorrect |
50 ms |
248 KB |
Wrong Answer [5] |
5 |
Incorrect |
38 ms |
248 KB |
Wrong Answer [5] |
6 |
Incorrect |
38 ms |
376 KB |
Wrong Answer [5] |
7 |
Incorrect |
35 ms |
348 KB |
Wrong Answer [5] |
8 |
Incorrect |
37 ms |
248 KB |
Wrong Answer [5] |
9 |
Incorrect |
39 ms |
248 KB |
Wrong Answer [5] |
10 |
Incorrect |
24 ms |
248 KB |
Wrong Answer [5] |
11 |
Runtime error |
5 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Incorrect |
5 ms |
376 KB |
Wrong Answer [5] |
13 |
Incorrect |
5 ms |
380 KB |
Wrong Answer [5] |
14 |
Incorrect |
5 ms |
248 KB |
Wrong Answer [5] |
15 |
Incorrect |
6 ms |
376 KB |
Wrong Answer [5] |
16 |
Incorrect |
6 ms |
248 KB |
Wrong Answer [5] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
556 KB |
Wrong Answer [5] |
2 |
Incorrect |
33 ms |
248 KB |
Wrong Answer [5] |
3 |
Incorrect |
35 ms |
248 KB |
Wrong Answer [5] |
4 |
Incorrect |
50 ms |
248 KB |
Wrong Answer [5] |
5 |
Incorrect |
38 ms |
248 KB |
Wrong Answer [5] |
6 |
Incorrect |
38 ms |
376 KB |
Wrong Answer [5] |
7 |
Incorrect |
35 ms |
348 KB |
Wrong Answer [5] |
8 |
Incorrect |
37 ms |
248 KB |
Wrong Answer [5] |
9 |
Incorrect |
39 ms |
248 KB |
Wrong Answer [5] |
10 |
Incorrect |
24 ms |
248 KB |
Wrong Answer [5] |
11 |
Runtime error |
5 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Incorrect |
5 ms |
376 KB |
Wrong Answer [5] |
13 |
Incorrect |
5 ms |
380 KB |
Wrong Answer [5] |
14 |
Incorrect |
5 ms |
248 KB |
Wrong Answer [5] |
15 |
Incorrect |
6 ms |
376 KB |
Wrong Answer [5] |
16 |
Incorrect |
6 ms |
248 KB |
Wrong Answer [5] |
17 |
Incorrect |
360 ms |
428 KB |
Wrong Answer [5] |
18 |
Incorrect |
359 ms |
504 KB |
Wrong Answer [5] |
19 |
Incorrect |
372 ms |
344 KB |
Wrong Answer [5] |
20 |
Incorrect |
331 ms |
504 KB |
Wrong Answer [5] |
21 |
Incorrect |
285 ms |
380 KB |
Wrong Answer [5] |
22 |
Incorrect |
351 ms |
460 KB |
Wrong Answer [5] |
23 |
Incorrect |
322 ms |
376 KB |
Wrong Answer [5] |
24 |
Incorrect |
137 ms |
552 KB |
Wrong Answer [5] |
25 |
Incorrect |
375 ms |
376 KB |
Wrong Answer [5] |
26 |
Incorrect |
305 ms |
504 KB |
Wrong Answer [5] |
27 |
Incorrect |
121 ms |
248 KB |
Wrong Answer [5] |
28 |
Incorrect |
314 ms |
376 KB |
Wrong Answer [5] |
29 |
Incorrect |
267 ms |
504 KB |
Wrong Answer [5] |
30 |
Incorrect |
259 ms |
376 KB |
Wrong Answer [5] |