# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
101026 |
2019-03-16T04:36:16 Z |
Pro_ktmr |
Park (JOI17_park) |
C++14 |
|
172 ms |
632 KB |
#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++){
~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
356 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
172 ms |
504 KB |
Output is correct |
2 |
Incorrect |
91 ms |
632 KB |
Wrong Answer[5] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |