# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
521780 |
2022-02-03T06:09:14 Z |
qwerasdfzxcl |
Park (JOI17_park) |
C++14 |
|
249 ms |
532 KB |
#include "park.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static int Place[1400];
int a[2020];
int ask(int x, int y){return Ask(min(x, y), max(x, y), Place);}
void answer(int x, int y){Answer(min(x, y), max(x, y));}
void _sort(int n){
vector<int> ans = {0};
for (int i=1;i<n;i++){
fill(Place, Place+1400, 1);
int l = 1, r = (int)ans.size()-1, idx = 0;
while(l<=r){
int m = (l+r)>>1;
for (int j=m;j<(int)ans.size();j++) Place[ans[j]] = 0;
if (ask(0, i)) r = m-1;
else l = m+1, idx = m;
for (int j=m;j<(int)ans.size();j++) Place[ans[j]] = 1;
}
ans.insert(ans.begin()+idx+1, i);
}
for (int i=0;i<n;i++) a[i] = ans[i];
}
vector<pair<int, int>> D;
int cnt = 1;
void Find(int x){
fill(Place, Place+1400, 1);
int l = 1, r = cnt-1, idx = 0;
while(l<=r){
int m = (l+r)>>1;
for (int i=m;i<cnt;i++) Place[D[i].first] = 0;
if (!ask(0, x)) idx = m, l = m+1;
else r = m-1;
}
answer(D[idx].first, x);
int pt = 0;
for (;pt<cnt;pt++) if (D[pt].second > D[idx].second+1) break;
D.insert(D.begin()+pt, make_pair(x, D[idx].second+1));
cnt++;
}
void Detect(int T, int N) {
for (int i=1;i<N;i++) a[i] = i;
_sort(N);
//printf("A = ");
//for (int i=0;i<N;i++) printf("%d ", a[i]);
//printf("\n");
D.emplace_back(0, 0);
for (int i=1;i<N;i++){
Find(a[i]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
249 ms |
480 KB |
Output is correct |
2 |
Correct |
104 ms |
456 KB |
Output is correct |
3 |
Correct |
108 ms |
444 KB |
Output is correct |
4 |
Correct |
238 ms |
460 KB |
Output is correct |
5 |
Correct |
238 ms |
432 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
140 ms |
400 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
67 ms |
332 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
174 ms |
532 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |