# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
579973 |
2022-06-20T12:06:02 Z |
josanneo22 |
Game (APIO22_game) |
C++17 |
|
0 ms |
0 KB |
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b); i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
#define mp make_pair
#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second
#define out(x) cout<<x<<'\n';
#define in(x) cin>>x;
#define inarr(a,x,y) for(int i=x;i<y;i++){cin>>a[i];}
#define incor(a,x,y) for(int i=x;i<y;i++){cin>>a[i].f>>a[i].s;}
int dx[4] = { -1, 0, 1, 0 };
int dy[4] = { 0, 1, 0, -1 };
const int mod = 1e9 + 7;
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
vi adj[1024];
int n, k;
void init(int N, int K) {
n = N;
k = K;
FOR(i,0,k-1)
adj[i].push_back(i + 1);
}
int vis[1024];
bool dfs(int i) {
if (vis[i] == 2)
return true;
if (vis[i] == 1)
return i >= k;
vis[i] = 1;
trav(j,g[i])
{
if(!dfs(j))
return false;
}
vis[i] = 2;
return true;
}
int add_teleporter(int u, int v)
{
memset(vis, 0, sizeof(vis));
adj[u].push_back(v);
bool ok = dfs(0);
return ok ? 0 : 1;
}
Compilation message
game.cpp: In function 'bool dfs(int)':
game.cpp:57:9: error: 'g' was not declared in this scope
57 | trav(j,g[i])
| ^
game.cpp:19:33: note: in definition of macro 'trav'
19 | #define trav(a,x) for (auto& a: x)
| ^