Submission #1012004

#TimeUsernameProblemLanguageResultExecution timeMemory
1012004c2zi6Game (IOI14_game)C++14
42 / 100
1064 ms3460 KiB
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define all(a) (a).begin(), (a).end() #define replr(i, a, b) for (int i = int(a); i <= int(b); ++i) #define reprl(i, a, b) for (int i = int(a); i >= int(b); --i) #define rep(i, n) for (int i = 0; i < int(n); ++i) #define mkp(a, b) make_pair(a, b) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VPI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; typedef vector<VPI> VVPI; typedef pair<ll, ll> PLL; typedef vector<ll> VL; typedef vector<PLL> VPL; typedef vector<VL> VVL; typedef vector<VVL> VVVL; typedef vector<VPL> VVPL; template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;} template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;} #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #include "game.h" int n; bool rem[2000][2000]; VVI gp; void initialize(int N) { n = N; } VI vis; VI compret; void dfs(int u, int d = -1) { compret.pb(u); vis[u] = true; for (int v : gp[u]) if (v != d && !vis[v]) { dfs(v); } } VI comp(int u, int d = -1) { compret.clear(); vis = VI(n); dfs(u, d); /*cout << "comp(" << u << ", " << d << ")" << endl << " ";*/ /*for (int x : compret) cout << x << " "; cout << endl;*/ return compret; } bool most(int u, int v) { VI a = comp(u, v); VI b = comp(v, u); sort(all(a)); sort(all(b)); return a != b; } int hasEdge(int u, int v) { gp = VVI(n); rep(u, n) rep(v, n) if (u != v) { if (!rem[u][v]) gp[u].pb(v); } /*cout << "GRAPH" << endl;*/ /*rep(u, n) {*/ /* cout << u << ": ";*/ /* for (int v : gp[u]) cout << v << " ";*/ /* cout << endl;*/ /*}*/ if (most(u, v)) { return true; } rem[u][v] = rem[v][u] = true; return false; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...