#include <cstdio>
#include <vector>
#include "library.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int maxn = 1100;
vector<int>adj[maxn];
void Solve(int N) {
vector<int> M(N);
for(int i=0;i<N;i++) {
M[i] = 0;
}
if(N == 1) {
vector<int>v;
v.pb(1);
Answer(v);
return;
}
for(int i=1;i<=N;i++) {
for(int j=i+1;j<=N;j++) {
M[i-1] = M[j-1] = 1;
int x = Query(M);
if(x == 1) {
adj[i].pb(j);
adj[j].pb(i);
}
M[i-1] = M[j-1] = 0;
}
}
int st = 1;
for(int i=1;i<=N;i++) {
if(adj[i].size() == 1) {
st = i;
break;
}
}
vector<int>v;
v.pb(st);
st = adj[st][0];
for(int i=0;i<N-1;i++) {
if(adj[st][0] == v.back()) {
v.pb(st);
st = adj[st][1];
}
else {
v.pb(st);
st = adj[st][0];
}
}
Answer(v);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
221 ms |
256 KB |
# of queries: 18336 |
2 |
Correct |
205 ms |
256 KB |
# of queries: 18145 |
3 |
Correct |
229 ms |
376 KB |
# of queries: 19900 |
4 |
Correct |
253 ms |
256 KB |
# of queries: 19900 |
5 |
Correct |
246 ms |
256 KB |
# of queries: 19900 |
6 |
Correct |
220 ms |
432 KB |
# of queries: 19900 |
7 |
Correct |
263 ms |
344 KB |
# of queries: 19900 |
8 |
Correct |
214 ms |
384 KB |
# of queries: 18528 |
9 |
Correct |
294 ms |
376 KB |
# of queries: 19701 |
10 |
Correct |
130 ms |
344 KB |
# of queries: 8256 |
11 |
Correct |
2 ms |
256 KB |
# of queries: 0 |
12 |
Correct |
2 ms |
256 KB |
# of queries: 1 |
13 |
Correct |
2 ms |
384 KB |
# of queries: 3 |
14 |
Correct |
3 ms |
384 KB |
# of queries: 6 |
15 |
Correct |
3 ms |
384 KB |
# of queries: 105 |
16 |
Correct |
8 ms |
256 KB |
# of queries: 351 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
221 ms |
256 KB |
# of queries: 18336 |
2 |
Correct |
205 ms |
256 KB |
# of queries: 18145 |
3 |
Correct |
229 ms |
376 KB |
# of queries: 19900 |
4 |
Correct |
253 ms |
256 KB |
# of queries: 19900 |
5 |
Correct |
246 ms |
256 KB |
# of queries: 19900 |
6 |
Correct |
220 ms |
432 KB |
# of queries: 19900 |
7 |
Correct |
263 ms |
344 KB |
# of queries: 19900 |
8 |
Correct |
214 ms |
384 KB |
# of queries: 18528 |
9 |
Correct |
294 ms |
376 KB |
# of queries: 19701 |
10 |
Correct |
130 ms |
344 KB |
# of queries: 8256 |
11 |
Correct |
2 ms |
256 KB |
# of queries: 0 |
12 |
Correct |
2 ms |
256 KB |
# of queries: 1 |
13 |
Correct |
2 ms |
384 KB |
# of queries: 3 |
14 |
Correct |
3 ms |
384 KB |
# of queries: 6 |
15 |
Correct |
3 ms |
384 KB |
# of queries: 105 |
16 |
Correct |
8 ms |
256 KB |
# of queries: 351 |
17 |
Execution timed out |
3073 ms |
424 KB |
Time limit exceeded |
18 |
Execution timed out |
3093 ms |
348 KB |
Time limit exceeded |
19 |
Execution timed out |
3050 ms |
384 KB |
Time limit exceeded |
20 |
Execution timed out |
3022 ms |
384 KB |
Time limit exceeded |
21 |
Execution timed out |
3081 ms |
384 KB |
Time limit exceeded |
22 |
Execution timed out |
3066 ms |
384 KB |
Time limit exceeded |
23 |
Execution timed out |
3050 ms |
284 KB |
Time limit exceeded |
24 |
Runtime error |
983 ms |
472 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
25 |
Execution timed out |
3075 ms |
384 KB |
Time limit exceeded |
26 |
Execution timed out |
3021 ms |
384 KB |
Time limit exceeded |
27 |
Runtime error |
994 ms |
468 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
28 |
Execution timed out |
3008 ms |
304 KB |
Time limit exceeded |
29 |
Execution timed out |
3009 ms |
384 KB |
Time limit exceeded |
30 |
Execution timed out |
3015 ms |
384 KB |
Time limit exceeded |