| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1333320 | Andrey | Game (APIO22_game) | C++20 | 4 ms | 472 KiB |
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 350000;
vector<int> haha[MAXN][2];
int bruh[MAXN][2];
int n,k;
void init(int N, int K) {
n = N;
k = K;
for(int i = 1; i <= n; i++) {
bruh[i][0] = 0;
bruh[i][1] = (1 << 30)-1;
}
for(int i = 1; i <= k; i++) {
bruh[i][0] = i;
bruh[i][1] = i;
}
}
bool dfs(int a, int c, int t) {
if(t) {
bruh[a][t]&=c;
}
else {
bruh[a][t]|=c;
}
if(a > k && (bruh[a][0] >= bruh[a][1])) {
return true;
}
for(int v: haha[a][t]) {
if(t) {
if((bruh[v][t]&c) < bruh[v][t]) {
if(dfs(v,c,t)) {
return true;
}
}
}
else {
if((bruh[v][t]|c) > bruh[v][t]) {
if(dfs(v,c,t)) {
return true;
}
}
}
}
return false;
}
int add_teleporter(int u, int v) {
u++;
v++;
if(max(u,v) <= k) {
if(u >= v) {
return true;
}
else {
return false;
}
}
if(u == v) {
return false;
}
haha[u][0].push_back(v);
haha[v][1].push_back(u);
if(dfs(u,bruh[u][0],0) || dfs(v,bruh[v][1],1)) {
return true;
}
return false;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
