제출 #19044

#제출 시각아이디문제언어결과실행 시간메모리
19044suhgyuho_william게임 (IOI14_game)C++98
100 / 100
601 ms31280 KiB
#include "game.h" #include <algorithm> #include <vector> using namespace std; int N; int a[1510][1510]; vector<int> edge[1510]; void initialize(int n) { N = n; int i,j; for(i=1; i<=N; i++){ for(j=1; j<=N; j++){ a[i][j] = -1; } while(!edge[i].empty()) edge[i].pop_back(); edge[i].push_back(i); } } int hasEdge(int u, int v) { int i,j; int v1,v2; int t1,t2; u++; v++; t1 = edge[u].size(); t2 = edge[v].size(); for(i=0; i<t1; i++){ for(j=0; j<t2; j++){ v1 = edge[u][i]; v2 = edge[v][j]; if(v1 == u && v2 == v) continue; if(a[v1][v2] == -1){ a[u][v] = a[v][u] = 0; return 0; } } } for(i=0; i<t1; i++){ for(j=0; j<t2; j++){ a[edge[u][i]][edge[v][j]] = a[edge[v][j]][edge[u][i]] = 1; edge[edge[u][i]].push_back(edge[v][j]); edge[edge[v][j]].push_back(edge[u][i]); } } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...