# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
328717 | dolphingarlic | Fancy Fence (CEOI20_fancyfence) | C++14 | 86 ms | 21880 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>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
int n, m = 0;
ll h[100002], w[100002];
ll node_h[100002], node_w[100002], ans = 0;
pair<ll, int> srt[100002];
int cmp[100002], nd[100002], cnt = 0;
set<int> graph[100002];
int find(int A) {
while (A != cmp[A]) cmp[A] = cmp[cmp[A]], A = cmp[A];
return A;
}
void onion(int A, int B) {
if (find(A) == find(B)) return;
node_w[nd[find(B)]] += node_w[nd[find(A)]];
if (node_w[nd[find(B)]] >= MOD) node_w[nd[find(B)]] -= MOD;
graph[nd[find(B)]].insert(nd[find(A)]);
nd[find(A)] = nd[find(B)];
cmp[find(A)] = cmp[find(B)];
}
ll c2(ll num) { return num * (num - 1) % MOD * 500000004 % MOD; }
void dfs(int node, ll depth, ll prv = 0) {
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |