Submission #422067

#TimeUsernameProblemLanguageResultExecution timeMemory
422067SAADGame (IOI14_game)C++17
0 / 100
1 ms332 KiB
#define F first #define S second #define rep(i,a,b) for(int i=a;!(a==b&&i!=b)&&((i<=b&&b>=a)||(i>=b&&a>=b));i+=(a<=b?1:-1)) #define pb push_back #define Fbitl __builtin_ffs #define bit1 __builtin_popcount #include <iostream> #include <math.h> #include <algorithm> #include <string.h> #include <vector> #include <queue> #include <map> #include <unordered_map> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vii; typedef vector<ll> vl; typedef vector<vl> vvl; int j, c, th[1502], n, res; bool who[1502]; short int x[1502][1502]; void initialize(int n) { ::n = n; j = n * (n - 1) / 2; } int hasEdge(int u, int v) { c++; int ans = 0; if (v < u) swap(v, u); th[u]++; th[v]++; if ( x[u][v] == 2 ) { ans = 1; } else if ((th[u] != n - 1) && (th[v] != n - 1) ) { ans = 0; x[u][v] = x[v][u] = 1; } else { x[u][v] = x[v][u] = 2; who[u] = true; ans = 1; } if (th[u] == n - 2) { for (int i = 0; i < n; i++) { if ( !x[u][i] && u != i && !who[i] ) { x[u][i] = x[i][u] = 2; who[i] = true; th[i]++; th[u]++; break; } } } if (th[v] == n - 2) { for (int i = 0; i < n; i++) { if ( !x[v][i] && v != i && !who[i]) { x[i][v] = x[v][i] = 2; th[v]++; th[i]++; who[i] = true; break; } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...