# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
125400 |
2019-07-05T08:12:26 Z |
이온조(#3059) |
Park (JOI17_park) |
C++14 |
|
702 ms |
760 KB |
#include "park.h"
#include <bits/stdc++.h>
using namespace std;
static int N, P[1444], O[1444];
void answer(int u, int v) {
if(u > v) swap(u, v);
// printf("answer: %d %d\n", u, v);
Answer(u, v);
}
int ask(int A, int B, int p[]) {
if(A > B) swap(A, B);
// printf("A: %d, B: %d\n", A, B);
// printf("PLACE: ");
// for(int i=0; i<N; i++) printf("%d", p[i]);
// printf("\n result: ");
int tmp = Ask(A, B, p);
// printf("%d\n", tmp);
return tmp;
}
void go(vector<int> &S, int id) {
int K = S.size();
if(K == 0) return;
int x = S[rand() % K];
if(K == 1) {
O[id] = S[0];
return;
}
P[x] = 0;
vector<int> L, R;
for(auto& it: S) {
if(it == x) continue;
if(ask(0, it, P)) L.push_back(it);
else R.push_back(it);
}
O[id + L.size()] = x;
P[x] = 1;
go(L, id);
go(R, id + L.size() + 1);
}
void Detect(int T, int N) {
srand(190705);
::N = N;
vector<int> S;
for(int i=1; i<N-1; i++) S.push_back(i);
for(int i=0; i<N; i++) P[i] = 1;
go(S, 1); O[0] = 0; O[N-1] = N-1;
for(int i=1; i<N; i++) answer(O[i-1], O[i]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
157 ms |
632 KB |
Output is correct |
2 |
Correct |
107 ms |
504 KB |
Output is correct |
3 |
Correct |
120 ms |
504 KB |
Output is correct |
4 |
Correct |
153 ms |
552 KB |
Output is correct |
5 |
Correct |
162 ms |
544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
493 ms |
760 KB |
Wrong Answer[5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
341 ms |
644 KB |
Wrong Answer[5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
702 ms |
732 KB |
Wrong Answer[5] |
2 |
Halted |
0 ms |
0 KB |
- |