Submission #1288446

#TimeUsernameProblemLanguageResultExecution timeMemory
1288446blackscreen1Game (IOI14_game)C++20
100 / 100
251 ms24720 KiB
#include "game.h" #include <bits//stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset; #define ll long long #define ld long double #define iloop(m, h) for (auto i = m; i != h; i += (m < h ? 1 : -1)) #define jloop(m, h) for (auto j = m; j != h; j += (m < h ? 1 : -1)) #define kloop(m, h) for (auto k = m; k != h; k += (m < h ? 1 : -1)) #define lloop(m, h) for (auto l = m; l != h; l += (m < h ? 1 : -1)) #define iloop_(m, h, g) for (auto i = m; i < h; i += g) #define jloop_(m, h, g) for (auto j = m; j < h; j += g) #define kloop_(m, h, g) for (auto k = m; k < h; k += g) #define lloop_(m, h, g) for (auto l = m; l < h; l += g) #define getchar_unlocked _getchar_nolock // comment before submission #define pll pair<ll, ll> #define plll pair<ll, pll> #define pllll pair<pll, pll> #define vll vector<ll> #define qll queue<ll> #define dll deque<ll> #define pqll priority_queue<ll> #define gll greater<ll> #define INF 1000000000000000 #define MOD1 1000000007 #define MOD2 998244353 #define MOD3 1000000009 mt19937 rng(chrono::system_clock::now().time_since_epoch().count()); ll par[1505], conn[1505][1505], sz[1505], N; ll find(ll x) { return (par[x] == x ? x : par[x] = find(par[x])); } void merge(ll x, ll y) { if (sz[x] < sz[y]) swap(x, y); par[y] = x; sz[x] += sz[y]; iloop(0, N) if (find(i) == i && find(i) != x) conn[i][x] += conn[i][y], conn[x][i] += conn[y][i]; } void initialize(int n) { N = n; iloop(0, n) par[i] = i, sz[i] = 1; } int hasEdge(int u, int v) { if (find(u) == find(v)) return 1; u = find(u), v = find(v); if (conn[u][v] != sz[u] * sz[v] - 1) { conn[u][v]++; conn[v][u]++; return 0; } merge(u, v); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...