Submission #254200

#TimeUsernameProblemLanguageResultExecution timeMemory
254200PedroBigManGame (IOI14_game)C++14
42 / 100
1091 ms888 KiB
#include "game.h" #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <queue> #include <deque> #include <list> #include <iomanip> #include <stdlib.h> #include <time.h> #include <cstring> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define whole(x) x.begin(),x.end() #define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl #define INF 500000000LL #define EPS 0.00000001 #define pi 3.14159 ll N; struct hash_pair { template <class T1, class T2> size_t operator() (pair<T1, T2> p) const { size_t hash1 = hash<T1>()(p.first); size_t hash2 = hash<T2>()(p.second); return (hash1 ^ hash2); } }; unordered_set<pl,hash_pair> cut; vector<bool> visited; void initialize(int n) { N=(ll) n; REP(i,0,N) {visited.pb(false);} } void DFS(ll s) { visited[s]=true; REP(i,0,N) { if(visited[i] || i==s) {continue;} if(cut.find(mp(s,i))!=cut.end() || cut.find(mp(i,s))!=cut.end()) {continue;} DFS(i); } } int hasEdge(int u, int v) { cut.insert(mp(u,v)); REP(i,0,N) {visited[i]=false;} DFS(0); cut.erase(mp(u,v)); bool connected=true; REP(i,0,N) {if(!visited[i]) {connected=false; break;}} if(connected) {cut.insert(mp(u,v)); return 0;} else {return 1;} }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...