제출 #640412

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6404122022-09-14 15:08:12qwerasdfzxcl게임 (APIO22_game)C++17
100 / 100
1876 ms96740 KiB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> adj[600600], INV[600600];
int n, k, cyc;
ll a[600600]; ///1 -> left, 2 -> right, 3 -> cycle (bit string)
void add_edge(int x, int y, int first = 1){
if (first) {adj[x].push_back(y); INV[y].push_back(x);}
if (cyc) return;
int l = 1, r = k;
ll prvx = a[x], prvy = a[y];
for (int i=0;;i+=2){
if (l>r) break;
assert(i<=40);
int m = (l+r)>>1;
if (x==m) a[x] |= 1LL<<i;
if (x==m+n) a[x] |= 2LL<<i;
if (y==m) a[x] |= 1LL<<i;
if (y==m+n) a[y] |= 2LL<<i;
if (a[x]&(2LL<<i)) a[y] |= 2LL<<i;
if (a[y]&(1LL<<i)) a[x] |= 1LL<<i;
if ((a[x]&(3LL<<i)) == (3LL<<i)) cyc = 1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...