제출 #897077

#제출 시각아이디문제언어결과실행 시간메모리
897077vjudge1Game (APIO22_game)C++17
2 / 100
1 ms2648 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; const int N = 3e4+4, K = 1e3+3, inf = INT_MAX; bool cycle; int n, k, mx[N], mn[N]; bitset<N> bt[K]; void init(int N, int K) { n = N; k = K; cycle = 0; for (int i = 0; i < n; i++) { mn[i] = inf; mx[i] = -inf; } for (int i = 0; i < k; i++) { bt[i].reset(); } } int add_teleporter(int u, int v) { if (cycle) return 1; if (u < k && u == v) return cycle = 1; if (min(u, v) >= k) { for (int i = 0; i < k; i++) { if (!bt[i][u]) continue; bt[i][v] = 1; mx[v] = max(mx[v], i); } } else if (u < k && v < k) { if (u < v) return 0; else return cycle = 1; } else if (u < k) { bt[u][v] = 1; mx[v] = max(mx[v], u); } else { mn[u] = min(mn[u], v); } if (mn[u] <= mx[u]) cycle = 1; else if (mn[v] <= mx[v]) cycle = 1; return cycle; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...