#include <cstdio>
#include <vector>
#include "library.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) int((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define OK cout << "OK" << endl;
void Solve(int n){
vector <int> res(n);
if(n == 1){
res[0] = 1;
}
else if(n <= 200){
vector <vector <int>> graph(n);
for(int i = 0; i < n; i++){
for(int j = i+1; j < n; j++){
vector <int> m(n);
m[i] = m[j] = 1;
auto it = Query(m);
if(it == 1){
graph[i].pb(j);
graph[j].pb(i);
}
}
}
int start = 0;
for(int i = 0; i < n; i++) if(sz(graph[i]) == 1){
start = i;
break;
}
res[0] = start+1;
int p = start;
start = graph[start][0];
int cnt = 1;
while(sz(graph[start]) > 1){
res[cnt] = start+1;
for(auto to : graph[start]){
if(to != p){
p = start;
start = to;
break;
}
}
cnt++;
}
res[cnt] = start+1;
}
Answer(res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
257 ms |
364 KB |
# of queries: 18336 |
2 |
Correct |
259 ms |
364 KB |
# of queries: 18145 |
3 |
Correct |
292 ms |
492 KB |
# of queries: 19900 |
4 |
Correct |
313 ms |
384 KB |
# of queries: 19900 |
5 |
Correct |
321 ms |
364 KB |
# of queries: 19900 |
6 |
Correct |
301 ms |
364 KB |
# of queries: 19900 |
7 |
Correct |
329 ms |
492 KB |
# of queries: 19900 |
8 |
Correct |
201 ms |
384 KB |
# of queries: 18528 |
9 |
Correct |
218 ms |
384 KB |
# of queries: 19701 |
10 |
Correct |
111 ms |
492 KB |
# of queries: 8256 |
11 |
Correct |
0 ms |
364 KB |
# of queries: 0 |
12 |
Correct |
1 ms |
364 KB |
# of queries: 1 |
13 |
Correct |
1 ms |
364 KB |
# of queries: 3 |
14 |
Correct |
1 ms |
364 KB |
# of queries: 6 |
15 |
Correct |
2 ms |
364 KB |
# of queries: 105 |
16 |
Correct |
5 ms |
364 KB |
# of queries: 351 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
257 ms |
364 KB |
# of queries: 18336 |
2 |
Correct |
259 ms |
364 KB |
# of queries: 18145 |
3 |
Correct |
292 ms |
492 KB |
# of queries: 19900 |
4 |
Correct |
313 ms |
384 KB |
# of queries: 19900 |
5 |
Correct |
321 ms |
364 KB |
# of queries: 19900 |
6 |
Correct |
301 ms |
364 KB |
# of queries: 19900 |
7 |
Correct |
329 ms |
492 KB |
# of queries: 19900 |
8 |
Correct |
201 ms |
384 KB |
# of queries: 18528 |
9 |
Correct |
218 ms |
384 KB |
# of queries: 19701 |
10 |
Correct |
111 ms |
492 KB |
# of queries: 8256 |
11 |
Correct |
0 ms |
364 KB |
# of queries: 0 |
12 |
Correct |
1 ms |
364 KB |
# of queries: 1 |
13 |
Correct |
1 ms |
364 KB |
# of queries: 3 |
14 |
Correct |
1 ms |
364 KB |
# of queries: 6 |
15 |
Correct |
2 ms |
364 KB |
# of queries: 105 |
16 |
Correct |
5 ms |
364 KB |
# of queries: 351 |
17 |
Incorrect |
1 ms |
364 KB |
Wrong Answer [5] |
18 |
Halted |
0 ms |
0 KB |
- |