제출 #422532

#제출 시각아이디문제언어결과실행 시간메모리
422532flappybird게임 (IOI14_game)C++14
100 / 100
620 ms38672 KiB
#include "game.h" #include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,fma") using namespace std; typedef int ll; #define MAX 1900 ll N; ll p[MAX]; ll line[MAX][MAX]; ll num[MAX]; ll mp[MAX][MAX]; ll find(ll x) { if (x == p[x]) return x; return p[x] = find(p[x]); } void uni(ll x, ll y) { x = find(x); y = find(y); ll i; p[y] = x; num[x] += num[y]; for (i = 0; i < N; i++) if (i != x && i != y) line[i][x] += line[i][y], line[x][i] += line[y][i]; } void initialize(int n) { N = n; ll i, j; for (i = 0; i < N; i++) p[i] = i, num[i] = 1; for (i = 0; i < N; i++) for (j = 0; j < N; j++) mp[i][j] = -1; } int hasEdge(int u, int v) { ll uu, vv; uu = u, vv = v; if (mp[uu][vv] != -1) return mp[uu][vv]; u = find(u); v = find(v); if (line[u][v] == num[u] * num[v] - 1) { uni(u, v); mp[uu][vv] = mp[vv][uu] = 1; return 1; } line[u][v]++; line[v][u]++; mp[uu][vv] = mp[vv][uu] = 0; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...