# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
920591 | rainboy | 문명 (KOI17_civilization) | C++17 | 505 ms | 68948 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 2000
#define M 100000
int max(int a, int b) { return a > b ? a : b; }
int di[] = { -1, 1, 0, 0 };
int dj[] = { 0, 0, -1, 1 };
int *eu[N], *ev[N], eo[N];
void append(int d, int u, int v) {
int o = eo[d]++;
if (o >= 2 && (o & o - 1) == 0) {
eu[d] = (int *) realloc(eu[d], o * 2 * sizeof *eu[d]);
ev[d] = (int *) realloc(ev[d], o * 2 * sizeof *ev[d]);
}
eu[d][o] = u, ev[d][o] = v;
}
int ds[M];
int find(int i) {
return ds[i] < 0 ? i : (ds[i] = find(ds[i]));
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |