#include <cstdio>
#include <vector>
#include "library.h"
using namespace std;
void Solve(int N)
{
if (N == 1) Answer({1});
int start = -1;
vector<int> toQuery(N, 1);
for (int i = 0; i < N; ++i) {
toQuery[i] = 0;
if (Query(toQuery) == 1) {
start = i;
break;
}
toQuery[i] = 1;
}
vector<int> ans{start};
// printf("start %d\n", start);
for (int i = 1; i < N; ++i) {
for (int pnext = 0; pnext < N; ++pnext) {
if (ans.size() > 1 && pnext == *next(ans.rbegin(), 1)) continue;
if (pnext == ans.back()) continue;
vector<int> toQuery(N);
toQuery[ans.back()] = toQuery[pnext] = 1;
if (Query(toQuery) == 1) {
ans.push_back(pnext);
// printf("next %d\n", pnext);
break;
}
}
}
vector<int> retVal;
for (int x : ans) retVal.push_back(x + 1);
Answer(retVal);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
192 ms |
404 KB |
# of queries: 18340 |
2 |
Correct |
282 ms |
384 KB |
# of queries: 18148 |
3 |
Correct |
204 ms |
256 KB |
# of queries: 19899 |
4 |
Correct |
269 ms |
404 KB |
# of queries: 19898 |
5 |
Correct |
333 ms |
256 KB |
# of queries: 19906 |
6 |
Correct |
263 ms |
256 KB |
# of queries: 19905 |
7 |
Correct |
285 ms |
328 KB |
# of queries: 19904 |
8 |
Correct |
314 ms |
384 KB |
# of queries: 18522 |
9 |
Correct |
261 ms |
332 KB |
# of queries: 19703 |
10 |
Correct |
134 ms |
256 KB |
# of queries: 8254 |
11 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [2] |
12 |
Correct |
2 ms |
256 KB |
# of queries: 2 |
13 |
Correct |
2 ms |
256 KB |
# of queries: 4 |
14 |
Correct |
2 ms |
384 KB |
# of queries: 6 |
15 |
Correct |
4 ms |
384 KB |
# of queries: 106 |
16 |
Correct |
4 ms |
256 KB |
# of queries: 354 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
192 ms |
404 KB |
# of queries: 18340 |
2 |
Correct |
282 ms |
384 KB |
# of queries: 18148 |
3 |
Correct |
204 ms |
256 KB |
# of queries: 19899 |
4 |
Correct |
269 ms |
404 KB |
# of queries: 19898 |
5 |
Correct |
333 ms |
256 KB |
# of queries: 19906 |
6 |
Correct |
263 ms |
256 KB |
# of queries: 19905 |
7 |
Correct |
285 ms |
328 KB |
# of queries: 19904 |
8 |
Correct |
314 ms |
384 KB |
# of queries: 18522 |
9 |
Correct |
261 ms |
332 KB |
# of queries: 19703 |
10 |
Correct |
134 ms |
256 KB |
# of queries: 8254 |
11 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [2] |
12 |
Correct |
2 ms |
256 KB |
# of queries: 2 |
13 |
Correct |
2 ms |
256 KB |
# of queries: 4 |
14 |
Correct |
2 ms |
384 KB |
# of queries: 6 |
15 |
Correct |
4 ms |
384 KB |
# of queries: 106 |
16 |
Correct |
4 ms |
256 KB |
# of queries: 354 |
17 |
Execution timed out |
3071 ms |
384 KB |
Time limit exceeded |
18 |
Execution timed out |
3029 ms |
384 KB |
Time limit exceeded |
19 |
Execution timed out |
3006 ms |
284 KB |
Time limit exceeded |
20 |
Execution timed out |
3068 ms |
384 KB |
Time limit exceeded |
21 |
Execution timed out |
3017 ms |
384 KB |
Time limit exceeded |
22 |
Execution timed out |
3028 ms |
256 KB |
Time limit exceeded |
23 |
Execution timed out |
3027 ms |
384 KB |
Time limit exceeded |
24 |
Incorrect |
1594 ms |
256 KB |
Wrong Answer [3] |
25 |
Execution timed out |
3031 ms |
256 KB |
Time limit exceeded |
26 |
Execution timed out |
3087 ms |
384 KB |
Time limit exceeded |
27 |
Incorrect |
1697 ms |
256 KB |
Wrong Answer [3] |
28 |
Execution timed out |
3045 ms |
324 KB |
Time limit exceeded |
29 |
Execution timed out |
3029 ms |
376 KB |
Time limit exceeded |
30 |
Execution timed out |
3055 ms |
324 KB |
Time limit exceeded |