# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
61207 |
2018-07-25T11:18:22 Z |
upsolving(#1740) |
Park (JOI17_park) |
C++11 |
|
62 ms |
1072 KB |
#include "park.h"
#include<cstdio>
#include<algorithm>
#include<vector>
#define N_ 1400
using namespace std;
vector<int>E[N_];
static int Place[N_];
int chk[N_], L[N_], cnt, n;
void DFS(int a) {
L[++cnt] = a;
for (auto &x : E[a]) {
DFS(x);
}
}
int Ask2(int a, int b) {
Place[a] = Place[b] = 1;
return Ask(min(a, b), max(a, b), Place);
}
void Make(int p, int a) {
int b = 0, e = n, mid, r = 0, i;
while (b <= e) {
mid = (b + e) >> 1;
for (i = 0; i < mid; i++) Place[i] = 1;
for (i = i; i < n; i++) Place[i] = 0;
if (Ask2(p, a)) {
r = mid;
e = mid - 1;
}
else b = mid + 1;
}
if (!r) {
E[p].push_back(a);
}
else {
Make(p, r - 1);
Make(r - 1, a);
}
chk[a] = 1;
}
void Add(int a) {
int i, j;
cnt = 0;
DFS(0);
int b = 1, e = cnt, mid, r = 0;
while (b <= e) {
mid = (b + e) >> 1;
for (i = 0; i < n; i++)Place[i] = 0;
for (i = 1; i <= mid; i++)Place[L[i]] = 1;
if (Ask2(0, a)) {
r = mid;
e = mid - 1;
}
else b = mid + 1;
}
Make(L[r], a);
}
void Detect(int T, int N) {
int i;
chk[0] = 1;
n = N;
for (i = 1; i < N; i++) {
if (!chk[i]) {
Add(i);
}
}
for (i = 0; i < N; i++) {
for (auto &x : E[i]) {
Answer(min(x, i), max(x, i));
}
}
}
Compilation message
park.cpp: In function 'void Add(int)':
park.cpp:47:9: warning: unused variable 'j' [-Wunused-variable]
int i, j;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Wrong Answer[3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
62 ms |
872 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
9 ms |
904 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
932 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
9 ms |
1072 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |