# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
875476 |
2023-11-19T20:23:11 Z |
LucaLucaM |
ICC (CEOI16_icc) |
C++17 |
|
205 ms |
856 KB |
#include "icc.h"
#ifdef LOCAL
#include "grader.cpp"
#endif // LOCAL
#include <vector>
#include <iostream>
#include <cassert>
#include <algorithm>
#include <cstring>
const int NMAX = 100;
int p[NMAX + 1];
int root(int u) {
if (p[u] == u) {
return u;
}
return p[u] = root(p[u]);
}
void join(int u, int v) {
u = root(u), v = root(v);
p[u] = v;
}
int ask(std::vector<int> a, std::vector<int> b) {
int sz_a = (int) a.size(), sz_b = (int) b.size();
int A[sz_a], B[sz_b];
for (int i = 0; i < sz_a; i++) {
A[i] = a[i];
}
for (int i = 0; i < sz_b; i++) {
B[i] = b[i];
}
return query(sz_a, sz_b, A, B);
}
void run(int n) {
bool before[n + 1][n + 1];
memset(before, false, sizeof(before));
for (int i = 1; i <= n; i++) {
p[i] = i;
}
for (int k = 1; k < n; k++) {
bool ok = false;
for (int i = 1; i < n && !ok; i++) {
for (int j = i + 1; j <= n && !ok; j++) {
if (!before[i][j] && root(i) != root(j)) {
before[i][j] = ask({i}, {j});
if (before[i][j]) {
join(i, j);
setRoad(i, j);
ok = true;
}
}
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
604 KB |
Ok! 1015 queries used. |
2 |
Correct |
33 ms |
632 KB |
Ok! 1010 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
181 ms |
856 KB |
Number of queries more than 5000 out of 2500 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
205 ms |
616 KB |
Number of queries more than 4500 out of 2250 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
190 ms |
852 KB |
Number of queries more than 4000 out of 2000 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
163 ms |
612 KB |
Number of queries more than 3550 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
154 ms |
616 KB |
Number of queries more than 3250 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |