#include <cstdio>
#include <vector>
#include "library.h"
using namespace std;
#define sz(x) (int) x.size()
bool vis[1050];
int L;
vector<int> ans;
void Solve(int N)
{
// find leftmost
for(int i=1;i<=N;i++){
vector<int> qv;
for(int j=1;j<=N;j++){
qv.push_back(1);
}
qv[i-1] = 0;
int res1 = Query(qv);
if( res1 == 1 ){
ans.push_back(i); vis[i] = 1;
break;
}
}
vector<int> qv(N);
// find left
while( sz(ans) < N ){
int L = ans[sz(ans)-1];
int t = 0;
for(int k=0;k<10;k++){
for(auto& e : qv) e = 0;
for(int i=1;i<=N;i++)if(!vis[i]){
if( i & (1<<k) ) qv[i-1] = 1;
}
bool all_zero = true;
for(auto e : qv) if( e != 0 ) all_zero = false;
if( all_zero ) continue;
int res1 = Query(qv);
qv[L-1] = 1;
int res2 = Query(qv);
if( res1 == res2 ) t |= (1<<k);
}
ans.push_back(t);
vis[t] = 1;
}
//for(auto e : ans ) printf("%d ",e);
Answer(ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
82 ms |
248 KB |
Output is correct |
2 |
Correct |
84 ms |
308 KB |
Output is correct |
3 |
Correct |
89 ms |
388 KB |
Output is correct |
4 |
Correct |
62 ms |
460 KB |
Output is correct |
5 |
Correct |
69 ms |
460 KB |
Output is correct |
6 |
Correct |
92 ms |
460 KB |
Output is correct |
7 |
Correct |
64 ms |
520 KB |
Output is correct |
8 |
Correct |
70 ms |
520 KB |
Output is correct |
9 |
Correct |
85 ms |
520 KB |
Output is correct |
10 |
Correct |
28 ms |
520 KB |
Output is correct |
11 |
Runtime error |
3 ms |
712 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
82 ms |
248 KB |
Output is correct |
2 |
Correct |
84 ms |
308 KB |
Output is correct |
3 |
Correct |
89 ms |
388 KB |
Output is correct |
4 |
Correct |
62 ms |
460 KB |
Output is correct |
5 |
Correct |
69 ms |
460 KB |
Output is correct |
6 |
Correct |
92 ms |
460 KB |
Output is correct |
7 |
Correct |
64 ms |
520 KB |
Output is correct |
8 |
Correct |
70 ms |
520 KB |
Output is correct |
9 |
Correct |
85 ms |
520 KB |
Output is correct |
10 |
Correct |
28 ms |
520 KB |
Output is correct |
11 |
Runtime error |
3 ms |
712 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Halted |
0 ms |
0 KB |
- |