#include "library.h"
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
int n;
void Solve(int N){
n = N;
vector<int> ans(N),fix(N),del(N);
for(int i = 0; i < N; i++) {
ans[i] = fix[i] = 0;
}
for (int i = 0; i < N; i++){
vector <int> M(N);
for (int j=0;j<N;j++){
M[j] = 1;
}
M[i] = 0;
int A;
if (N == 1) A = 1;
else A = Query(M);
if (A == 1){
fix[i] = 1;
ans[0] = i;
break;
}
}
for (int i = 0; i + 1 < N; i++){
int find = 0;
for (int j = 0; j < 10; j++){
vector <int> M(N);
int ones=0;
for (int w = 0; w < N; w++){
M[w] = 0;
if (fix[w]) M[w] = 0;
else {
int bt = ((w >> j) & 1);
if (bt) M[w] = 1,++ones;
}
}
M[ans[i]] = 1;
ones++;
int A = Query(M);
M[ans[i]] = 0;
ones--;
int B;
if (ones == 0) B = 0;
else B = Query(M);
if (A == B) find |= (1<<j);
}
fix[find] = 1;
ans[i + 1] = find;
}
for (int i=0;i<N;i++)
ans[i] += 1;
Answer(ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
344 KB |
# of queries: 3452 |
2 |
Correct |
24 ms |
344 KB |
# of queries: 3470 |
3 |
Correct |
36 ms |
344 KB |
# of queries: 3718 |
4 |
Correct |
31 ms |
344 KB |
# of queries: 3664 |
5 |
Correct |
34 ms |
344 KB |
# of queries: 3577 |
6 |
Correct |
22 ms |
344 KB |
# of queries: 3629 |
7 |
Correct |
32 ms |
344 KB |
# of queries: 3635 |
8 |
Correct |
35 ms |
344 KB |
# of queries: 3474 |
9 |
Correct |
30 ms |
344 KB |
# of queries: 3608 |
10 |
Correct |
19 ms |
344 KB |
# of queries: 2330 |
11 |
Correct |
0 ms |
340 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
344 KB |
# of queries: 12 |
13 |
Correct |
0 ms |
344 KB |
# of queries: 24 |
14 |
Correct |
1 ms |
344 KB |
# of queries: 37 |
15 |
Correct |
2 ms |
344 KB |
# of queries: 194 |
16 |
Correct |
3 ms |
344 KB |
# of queries: 397 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
344 KB |
# of queries: 3452 |
2 |
Correct |
24 ms |
344 KB |
# of queries: 3470 |
3 |
Correct |
36 ms |
344 KB |
# of queries: 3718 |
4 |
Correct |
31 ms |
344 KB |
# of queries: 3664 |
5 |
Correct |
34 ms |
344 KB |
# of queries: 3577 |
6 |
Correct |
22 ms |
344 KB |
# of queries: 3629 |
7 |
Correct |
32 ms |
344 KB |
# of queries: 3635 |
8 |
Correct |
35 ms |
344 KB |
# of queries: 3474 |
9 |
Correct |
30 ms |
344 KB |
# of queries: 3608 |
10 |
Correct |
19 ms |
344 KB |
# of queries: 2330 |
11 |
Correct |
0 ms |
340 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
344 KB |
# of queries: 12 |
13 |
Correct |
0 ms |
344 KB |
# of queries: 24 |
14 |
Correct |
1 ms |
344 KB |
# of queries: 37 |
15 |
Correct |
2 ms |
344 KB |
# of queries: 194 |
16 |
Correct |
3 ms |
344 KB |
# of queries: 397 |
17 |
Runtime error |
239 ms |
424 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |