#include <bits/stdc++.h>
#include "library.h"
//#include "grader.cpp"
using namespace std;
int l[2005] , r[2005] , marked[2005];
void Solve(int N)
{
memset(marked , 0 , sizeof(marked)) ;
memset(l , -1 , sizeof(l)) ;
memset(r , -1 , sizeof(r)) ;
vector<int> M(N);
for(int i = 0 ; i < N ; ++i)
M[i] = 0 ;
for(int i = 0 ; i < N ; ++i)
{
for(int j = i+1 ; j < N ; ++j)
{
M[i] = 1 ;
M[j] = 1 ;
int x = Query(M) ;
M[i] = 0 ;
M[j] = 0 ;
if(x == 1)
{
if(l[i] == -1)
l[i] = j ;
else
r[i] = j ;
if(l[j] == -1)
l[j] = i ;
else
r[j] = i ;
}
}
}
vector<int>res(N) ;
int nxt = -1 ;
for(int i = 0 ; i < N ; ++i)
{
if(r[i] == -1)
{
nxt = i ;
break ;
}
}
res[0] = nxt + 1 ;
marked[nxt] = 1 ;
nxt = l[nxt] ;
for(int i = 1 ; i < N ; ++i)
{
res[i] = nxt+1 ;
marked[nxt] = 1 ;
if(marked[l[nxt]])
nxt = r[nxt] ;
else
nxt = l[nxt] ;
}
Answer(res) ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
293 ms |
248 KB |
# of queries: 18336 |
2 |
Correct |
281 ms |
376 KB |
# of queries: 18145 |
3 |
Correct |
299 ms |
248 KB |
# of queries: 19900 |
4 |
Correct |
364 ms |
248 KB |
# of queries: 19900 |
5 |
Correct |
345 ms |
248 KB |
# of queries: 19900 |
6 |
Correct |
279 ms |
248 KB |
# of queries: 19900 |
7 |
Correct |
350 ms |
252 KB |
# of queries: 19900 |
8 |
Correct |
324 ms |
252 KB |
# of queries: 18528 |
9 |
Correct |
328 ms |
248 KB |
# of queries: 19701 |
10 |
Correct |
140 ms |
248 KB |
# of queries: 8256 |
11 |
Correct |
2 ms |
248 KB |
# of queries: 0 |
12 |
Correct |
2 ms |
248 KB |
# of queries: 1 |
13 |
Correct |
2 ms |
248 KB |
# of queries: 3 |
14 |
Correct |
2 ms |
248 KB |
# of queries: 6 |
15 |
Correct |
4 ms |
376 KB |
# of queries: 105 |
16 |
Correct |
6 ms |
248 KB |
# of queries: 351 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
293 ms |
248 KB |
# of queries: 18336 |
2 |
Correct |
281 ms |
376 KB |
# of queries: 18145 |
3 |
Correct |
299 ms |
248 KB |
# of queries: 19900 |
4 |
Correct |
364 ms |
248 KB |
# of queries: 19900 |
5 |
Correct |
345 ms |
248 KB |
# of queries: 19900 |
6 |
Correct |
279 ms |
248 KB |
# of queries: 19900 |
7 |
Correct |
350 ms |
252 KB |
# of queries: 19900 |
8 |
Correct |
324 ms |
252 KB |
# of queries: 18528 |
9 |
Correct |
328 ms |
248 KB |
# of queries: 19701 |
10 |
Correct |
140 ms |
248 KB |
# of queries: 8256 |
11 |
Correct |
2 ms |
248 KB |
# of queries: 0 |
12 |
Correct |
2 ms |
248 KB |
# of queries: 1 |
13 |
Correct |
2 ms |
248 KB |
# of queries: 3 |
14 |
Correct |
2 ms |
248 KB |
# of queries: 6 |
15 |
Correct |
4 ms |
376 KB |
# of queries: 105 |
16 |
Correct |
6 ms |
248 KB |
# of queries: 351 |
17 |
Execution timed out |
3067 ms |
248 KB |
Time limit exceeded |
18 |
Execution timed out |
3017 ms |
376 KB |
Time limit exceeded |
19 |
Execution timed out |
3011 ms |
376 KB |
Time limit exceeded |
20 |
Execution timed out |
3101 ms |
248 KB |
Time limit exceeded |
21 |
Execution timed out |
3047 ms |
376 KB |
Time limit exceeded |
22 |
Execution timed out |
3003 ms |
376 KB |
Time limit exceeded |
23 |
Execution timed out |
3034 ms |
376 KB |
Time limit exceeded |
24 |
Incorrect |
1134 ms |
376 KB |
Wrong Answer [3] |
25 |
Execution timed out |
3071 ms |
376 KB |
Time limit exceeded |
26 |
Execution timed out |
3038 ms |
248 KB |
Time limit exceeded |
27 |
Incorrect |
1073 ms |
376 KB |
Wrong Answer [3] |
28 |
Execution timed out |
3027 ms |
376 KB |
Time limit exceeded |
29 |
Execution timed out |
3025 ms |
376 KB |
Time limit exceeded |
30 |
Execution timed out |
3077 ms |
248 KB |
Time limit exceeded |