Submission #979770

#TimeUsernameProblemLanguageResultExecution timeMemory
979770Mher777Swapping Cities (APIO20_swap)C++17
0 / 100
78 ms5984 KiB
#include "swap.h" #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <iomanip> #include <array> #include <string> #include <algorithm> #include <cmath> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <vector> #include <stack> #include <queue> #include <deque> #include <bitset> #include <list> #include <iterator> #include <numeric> #include <complex> #include <utility> #include <random> #include <cassert> #include <fstream> using namespace std; mt19937 rnd(7069); typedef int itn; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef float fl; typedef long double ld; using vi = vector<int>; using vll = vector<ll>; using mii = map<int, int>; using mll = map<ll, ll>; using pii = pair<int, int>; using pll = pair<ll, ll>; #define ff first #define ss second #define pub push_back #define pob pop_back #define puf push_front #define pof pop_front #define mpr make_pair #define yes cout<<"Yes\n" #define no cout<<"No\n" #define all(x) (x).begin(), (x).end() const int dx[8] = { -1, 0, 1, 0, -1, -1, 1, 1 }; const int dy[8] = { 0, -1, 0, 1, -1, 1, -1, 1 }; const int MAX = int(1e9 + 5); const ll MAXL = ll(1e18) + 5ll; const ll MOD = ll(1000000007); const ll MOD2 = ll(998244353); const int N = 100005; int p[N], sz[N], check[N], deg[N]; vector<pair<int, pii>> edge; int n, m; void init(int N, int M, vi U, vi V, vi W) { n = N, m = M; for (int i = 0; i < m; ++i) { edge.pub({ W[i],{U[i],V[i]} }); } sort(all(edge)); } void make_set(int x) { p[x] = x; sz[x] = 1; check[x] = deg[x] = 0; } int find_set(int x) { if (x == p[x]) return x; return p[x] = find_set(p[x]); } void union_sets(int x, int y) { x = find_set(x); y = find_set(y); if (x == y) return; if (sz[x] < sz[y]) swap(x, y); p[y] = x; sz[x] += sz[y]; if (check[y]) check[x] = 1; } int getMinimumFuelCapacity(int X, int Y) { return -1; } /* 1. 5 6 0 1 4 0 2 4 1 2 1 1 3 2 1 4 10 2 3 3 3 1 2 2 4 0 1 2. 3 2 0 1 5 0 2 5 1 1 2 answers 1. 3 10 4 2. -1 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...