Submission #1049373

#TimeUsernameProblemLanguageResultExecution timeMemory
1049373Maite_MoraleGame (APIO22_game)C++17
12 / 100
4029 ms14156 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define vll vector<ll> #define pll pair<ll,ll> #define F first #define S second #define MAX 500005 vll vec[MAX]; ll n,pass[MAX],k; stack<ll> q; void init(int N, int K) { n=N; k=K; for(int i=0;i<k-1;i++)vec[i].push_back(i+1); } ll dfs(ll x,ll z){ pass[x]=z;ll r=0; for(auto w : vec[x]){ if(pass[w]!=z)r=max(r,dfs(w,z)); else if(w==z)r=1; } return r; } int add_teleporter(int u, int v1) { vec[u].push_back(v1); for(int i=0;i<n;i++)pass[i]=0; ll r=0; for(int i=0;i<k;i++){ r=max(r,dfs(i,i)); } return r; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...