제출 #918014

#제출 시각아이디문제언어결과실행 시간메모리
918014zhasyn게임 (IOI14_game)C++14
42 / 100
1055 ms5336 KiB
#include <bits/stdc++.h> #define pb push_back #define pf push_front using namespace std; #define F first #define S second typedef long long ll; #define pii pair <int, int> #define pll pair <ll, ll> typedef long double ld; const ll N = 1500 + 10, M = 30; const ll mod = 998244353; int g; bool block[N][N], was[N], pred[N][N]; void initialize(int n){ g = n; } void dfs(int v){ was[v] = true; for(int i = 0; i < g; i++){ if(was[i] || block[i][v] == true) continue; dfs(i); } } int hasEdge(int u, int v){ if(pred[u][v]) return block[u][v]; pred[u][v] = pred[v][u] = true; block[u][v] = block[v][u] = true; dfs(0); int cnt = 0; for(int i = 0; i < g; i++){ if(was[i]) cnt++; was[i] = false; } if(cnt != g) block[u][v] = block[v][u] = false; return 1 - block[u][v]; } // int main(){ // int n; // cin >> n; // initialize(n); // for(int i = 0, a, b; i < ((n + 1) * n) / 2; i++){ // cin >> a >> b; // cout << hasEdge(a, b) << endl; // } // return 0; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...