#include "coprobber.h"
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
// #define int long long
#define mod 1000000007
#define base 7001
#define base2 757
#define F first
#define S second
// #define pi acos(-1)
#define double long double
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>
// #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
// #pragma GCC optimize("O3,Ofast,unroll-loops")
// #pragma GCC target("avx2,sse3,sse4,avx")
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
constexpr int maxn = 1000005;
// const int N = 1 << (int)(ceil(log2(maxn)));
vector<int> adj[maxn];
int cur, n, r;
bool vis[maxn];
int dfs(int v) {
vis[v] = 1;
int ret = -1;
if (v == r) ret = v;
for (int u : adj[v]) {
if (!vis[u]) {
ret = max(dfs(u), ret);
}
}
return (ret != -1 ? v : ret);
}
int start(int N, bool A[MAX_N][MAX_N])
{
n = N;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (A[i][j]) adj[i].push_back(j);
}
}
return 0;
}
int nextMove(int R)
{
r = R;
int nxt = dfs(cur);
for (int i = 0; i < n; i++) vis[i] = 0;
return cur = nxt;
}
# | 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... |