# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
984107 | vjudge1 | Mars (APIO22_mars) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <time.h>
#include <cstdlib>
#include <stack>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <set>
#include <iterator>
#include <deque>
#include <queue>
#include <sstream>
#include <array>
#include <string>
#include <tuple>
#include <chrono>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <list>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <bitset>
#include "game.h"
#define ll long long
using namespace std;
vector<int> g[300005];
bool ok = 0, f = 0;;
bool us[300005], c[300005], dd[300005];
int N, K;
void dfs(int p){
us[p] = 1;
dd[p] = 1;
for(int to : g[p]){
if(to < K && dd[to] == 1) f = 1;
if(dd[to]) continue;
dfs(to);
}
dd[p] = 0;
}
void init(int n, int k){
for(int i = 0; i < k - 1; i++)
g[i].push_back(i + 1);
N = n;
K = k;
}
int add_teleporter(int u, int v) {
if(ok) return 1;
if(u < K && v < K && u >= v){
ok = 1;
return 1;
}
if(u < K && v < K) return 0;
g[u].push_back(v);
f = 0;
if(v < K) c[u] = 1;
dfs(0);
if(f == 1){
ok = 1;
return 1;
}
return 0;
}
// int a, b, t;
// int main(){
// cin >> a >> t;
// cin >> b;
// init(a, b);
// while(t--){
// int x, y;
// cin >> x >> y;
// cout << add_teleporter(x, y) << "\n";
// }
// }