#include <stdio.h>
#include <vector>
#include <library.h>
using namespace std;
int n;
vector<int> v, tak, res;
/*int Query( vector<int> m ) {
int ans, i;
for ( i = 0; i < n; i++ ) {
if ( m[i] == 1 )
printf( "%d ", i + 1 );
}
printf( "\n" );
scanf( "%d", &ans );
return ans;
}
void Answer( vector<int> m ) {
int i;
for ( i = 0; i < n; i++ )
printf( "%d ", m[i] );
}*/
void Solve( int n ) {
int ans, p, st, dr, mij, i, j;
for ( i = 0; i < n; i++ )
v.push_back( i );
for ( i = 0; i < n; i++ )
tak.push_back( 1 );
ans = 2;
i = 0;
while ( ans == 2 ) {
tak[v[i]] = 0;
ans = Query( tak );
tak[v[i]] = 1;
i++;
}
res.push_back( v[i - 1] + 1 );
p = i - 1;
for ( i = 1; i < n; i++ ) {
for ( j = p; j < n - (i - 1); j++ )
v[j] = v[j + 1];
st = 0;
dr = n - i;
while ( dr - st > 1 ) {
mij = (st + dr) / 2;
for ( j = 0; j < n; j++ )
tak[j] = 0;
for ( j = st; j < mij; j++ )
tak[v[j]] = 1;
ans = Query( tak );
tak[res[i - 1] - 1] = 1;
if ( Query( tak ) == ans )
dr = mij;
else
st = mij;
}
res.push_back( v[st] + 1 );
p = st;
}
Answer( res );
}
/*int main() {
scanf( "%d", &n );
Solve( n );
return 0;
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
200 KB |
# of queries: 2375 |
2 |
Correct |
45 ms |
200 KB |
# of queries: 2409 |
3 |
Correct |
45 ms |
200 KB |
# of queries: 2648 |
4 |
Correct |
42 ms |
200 KB |
# of queries: 2595 |
5 |
Correct |
43 ms |
200 KB |
# of queries: 2508 |
6 |
Correct |
39 ms |
200 KB |
# of queries: 2551 |
7 |
Correct |
36 ms |
200 KB |
# of queries: 2544 |
8 |
Correct |
42 ms |
200 KB |
# of queries: 2420 |
9 |
Correct |
36 ms |
200 KB |
# of queries: 2546 |
10 |
Correct |
21 ms |
200 KB |
# of queries: 1474 |
11 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
200 KB |
# of queries: 2375 |
2 |
Correct |
45 ms |
200 KB |
# of queries: 2409 |
3 |
Correct |
45 ms |
200 KB |
# of queries: 2648 |
4 |
Correct |
42 ms |
200 KB |
# of queries: 2595 |
5 |
Correct |
43 ms |
200 KB |
# of queries: 2508 |
6 |
Correct |
39 ms |
200 KB |
# of queries: 2551 |
7 |
Correct |
36 ms |
200 KB |
# of queries: 2544 |
8 |
Correct |
42 ms |
200 KB |
# of queries: 2420 |
9 |
Correct |
36 ms |
200 KB |
# of queries: 2546 |
10 |
Correct |
21 ms |
200 KB |
# of queries: 1474 |
11 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
12 |
Halted |
0 ms |
0 KB |
- |