| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 978632 | Nexus | 게임 (APIO22_game) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e3+9,M=2e18+9,L=18,mod=1e9+7;
bool balt;
ll vis[N],n,k,x,y;
vector<ll>v[N];
void dfs(ll node)
{
if(vis[node])
{
balt=1;
return;
}
vis[node]=1;
for(auto i:v[node])dfs(i);
}
void init(ll n,ll k)
{
--k;
for(ll i=0;i<k;++i)v[i].push_back(i+1);
}
bool add_teleporter(ll x,ll y)
{
v[x].push_back(y);
memset(vis,0,sizeof vis);
balt=0;
dfs(0);
return balt;
}
/*
int main()
{
ios::sync_with_stdio(0);
//cin.tie(0);cout.tie(0);
cin>>n>>k;
init(n,k);
while(1)
{
cin>>x>>y;
v[x].push_back(y);
if(add_teleporter(x,y))
{
cout<<1;
return 0;
}
cout<<0;
}
}
*/
