이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "game.h"
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
//#define lc (2*n)
//#define rc (2*n+1)
using namespace std;
bitset<900000000> path(0);
ll K , N;
void init(int n, int k)
{
N=n;
K=k;
for(int i = 0 ; n>i ; i++)
for(int j = 0 ; n>j ; j++)
path.reset(j+i*N);
for(int i = 0 ; k>i ; i++)
for(int j = i+1 ; k>j ; j++)
path.set(j+i*N);
}
int add_teleporter(int u, int v)
{
if(path.test(v+u*N)==1)
return 0;
path.set(v+u*N);
for(int i = 0 ; N>i ; i++)
{
if(path.test(u+i*N)==1)
{
for(int j = 0 ; N>j ; j++)
{
if(path.test(j+v*N)==1)
path.set(j+i*N);
}
}
}
for(int i = 0 ; N>i ; i++)
if(path.test(i+v*N)==1)
path.set(i+u*N);
for(int i = 0 ; N>i ; i++)
if(path.test(u+i*N)==1)
path.set(v+i*N);
for(int i = 0 ; K>i ; i++)
{
if(path.test(i+i*N)==1)
return 1;
}
return 0;
}
# | 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... |