# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
497673 | hgmhc | Kutije (COCI21_kutije) | C++17 | 157 ms | 9520 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>
#define REP(i,a,b) for (auto i = (a); i <= (b); ++i)
#define debug(x) cerr << #x << " is " << x << endl
#define el '\n'
using namespace std; using ll = long long;
const int N = 1003, Q = 500003;
struct DSU {
vector<int> par, sz;
DSU(int n): par(n+1), sz(n+1,1) {iota(par.begin(),par.end(),0);}
int find(int x) {
if (x == par[x]) return x;
return par[x] = find(par[x]);
}
void merge(int a, int b) {
a = find(a), b = find(b);
if (a == b) return;
if (sz[a] > sz[b]) swap(a,b);
sz[b] += sz[a];
par[a] = b;
}
int size(int x) {return sz[find(x)];}
bool same(int a, int b) {return find(a) == find(b);}
};
int main() {
cin.tie(0)->sync_with_stdio(0);
int n, m, q; cin >> n >> m >> q;
// n: the number of boxes
# | 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... |