#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define MP make_pair
#define PB push_back
#include"park.h"
int n;
bool great(int root, int a, int b){ //a < b
int P[1400];
for(int i=0; i<n; i++) P[i] = 1;
P[a] = 0;
if(Ask(root, b, P) == 0) return true;
else return false;
}
void Detect(int T, int N){
if(T != 2) return;
n = N;
int p[1400];
p[0] = 0;
p[N-1] = N-1;
queue<pair<int,vector<int>>> que;
vector<int> v;
for(int i=1; i<N-1; i++) v.PB(i);
que.push(MP(1, v));
while(!que.empty()){
int left = que.front().first;
v = que.front().second;
que.pop();
vector<int> vSmall,vLarge;
for(int i=1; i<v.size(); i++){
if(great(p[left-1], v[0], v[i])) vLarge.PB(v[i]);
else vSmall.PB(v[i]);
}
p[left+vSmall.size()] = v[0];
if(vSmall.size() > 0) que.push(MP(left, vSmall));
if(vLarge.size() > 0) que.push(MP(left+vSmall.size()+1, vLarge));
}
for(int i=0; i<N; i++) cout << p[i] << endl;
for(int i=0; i<N-1; i++) Answer(min(p[i], p[i+1]), max(p[i], p[i+1]));
}
Compilation message
park.cpp: In function 'void Detect(int, int)':
park.cpp:33:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=1; i<v.size(); i++){
~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
161 ms |
512 KB |
Program terminated incorrectly, or you printed something to stdout |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |