# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
968044 | weakweakweak | Binaria (CCO23_day1problem1) | C++17 | 211 ms | 35428 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 <bits/stdc++.h>
using namespace std;
const int M = 1000000 + 3, N = 1e6 + 10;
int a[N], ch[N], fa[N], dp[N] = {0}, fac[N], invfac[N];
int find (int x) {
return fa[x] == x ? x : fa[x] = find (fa[x]);
}
void add (int &x, int y) {
x += y;
if (x >= M) x -= M;
if (x < 0) x += M;
}
void merge (int i, int j) {
i = find(i), j = find(j);
if (i == j) return;
fa[i] = j;
if (ch[i] == 3 or ch[j] == 3) ch[j] = min(ch[i], ch[j]);
else if (ch[i] != ch[j]) {
cout << "0\n";
exit(0);
}
}
void f(int i, int val) {
i = find(i);
if (ch[i] == 3) ch[i] = val;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |