# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
869879 | hgmhc | Swapping Cities (APIO20_swap) | C++17 | 384 ms | 61420 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; using ii = pair<int,int>; using vi = vector<int>;
#define rep(i,a,b) for (auto i = (a); i <= (b); ++i)
#define per(i,a,b) for (auto i = (b); i >= (a); --i)
#define all(x) begin(x), end(x)
#define siz(x) int((x).size())
#define Mup(x,y) x = max(x,y)
#define mup(x,y) x = min(x,y)
#define fi first
#define se second
const int N = 1e5+3;
vector<tuple<int,int,int>> edges;
vector<ii> group_log[N];
int swappable_moment[N];
int timer;
int deg[N];
struct dsu {
set<int> s; int name; bool swappable;
dsu(int i): s({i}), name(i), swappable(0) {}
void insert(int x) {
if (s.count(x)) swappable=1;
else {
s.insert(x);
if (group_log[x].back().fi == timer) group_log[x].back().se = name;
else group_log[x].emplace_back(timer, name);
}
}
# | 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... |