# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
927292 | TAhmed33 | Swapping Cities (APIO20_swap) | C++17 | 2013 ms | 23744 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 MAXN = 1e5 + 25;
vector <pair <int, int>> adj[MAXN];
vector <int> adj2[MAXN];
bool vis[MAXN];
int deg[MAXN];
vector <int> t;
int n;
void init (int N, int m, vector <int> u, vector <int> v, vector <int> w) {
t = w; sort(t.begin(), t.end());
n = N;
for (int i = 0; i < m; i++) {
adj[u[i]].push_back({v[i], w[i]});
adj[v[i]].push_back({u[i], w[i]});
}
}
bool flag;
int cnt2 = 0;
void dfs (int pos) {
vis[pos] = 1;
flag |= deg[pos] > 2;
//cout << pos << " " << deg[pos] << '\n';
cnt2 += deg[pos] == 1;
for (auto j : adj2[pos]) {
if (!vis[j]) {
dfs(j);
}
}
}
# | 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... |