#include <bits/stdc++.h>
#include "park.h"
//#include "grader.cpp"
using namespace std;
static int Place[1400];
int n;
void solve1() {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
Place[i] = Place[j] = 1;
if (Ask(i, j, Place)) {
Answer(i, j);
}
Place[i] = Place[j] = 0;
}
}
}
int used[1400];
int deg[1400];
void solve2() {
vector < int > vec(n);
iota(vec.begin(), vec.end(), 0);
random_shuffle(vec.begin(), vec.end());
for (int i = 0; i < n; i++) {
int a = vec[i];
for (int j = i + 1; j < n; j++) {
int b = vec[j];
Place[a] = Place[b] = 1;
bool fl = 0;
if (a > b) swap(a, b), fl = 1;
// cout << a << ' ' << b << endl;
if (Ask(a, b, Place)) {
Answer(a, b);
// cout << 1 << endl;
deg[a]++;
deg[b]++;
used[a] = 1;
used[b] = 1;
} else {
// cout << 0 << endl;
}
if (fl) {
swap(a, b);
}
Place[a] = Place[b] = 0;
}
}
}
void Detect(int T, int N) {
srand(time(0));
n = N;
if (T == 1) {
solve1();
} else if (T == 2) {
solve2();
} else {
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
9 ms |
452 KB |
Output is correct |
3 |
Correct |
11 ms |
524 KB |
Output is correct |
4 |
Correct |
14 ms |
524 KB |
Output is correct |
5 |
Correct |
14 ms |
524 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
49 ms |
524 KB |
Wrong Answer[5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
524 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
524 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
580 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |