Submission #576826

#TimeUsernameProblemLanguageResultExecution timeMemory
576826Omar_ElgedawyGame (APIO22_game)C++17
12 / 100
4091 ms1292 KiB
#include <bits/stdc++.h> // #include "grader.cpp" using namespace std; #define cin(vec) for(auto& i : vec) cin >> i #define cout(vec) for(auto& i : vec) cout << i << " "; cout << "\n"; #define fast ios::sync_with_stdio(0);cin.tie(0); #define loop(i,a,b) for (int i = a; i < b; i++) #define F first #define S second #define pb(n) push_back(n) #define pf(n) push_front(n) #define dci(d) fixed<<setprecision(d) #define sp ' ' #define el '\n' #define all(v) v.begin(),v.end() int const N=30005; int n,k,vis[N],vid; vector<int>g[N]; void dfs(int u,int dpth){ if(dpth) vis[u]=vid; for(auto u:g[u]){ if(vis[u]!=vid){ vis[u]=vid; dfs(u,dpth+1); } } } void init(int _n, int _k) { n=_n;k=_k; for(int i=0;i<k-1;i++)g[i].pb(i+1); } int add_teleporter(int u, int v) { if(u<k&&v<k){ if(v<=u)return 1; } else if(u==v){ } else{ g[u].pb(v); int c=0; for(int i=0;i<k;i++){ vid++; dfs(i,0); if(vis[i]==vid)return 1; // cout<<i<<' '<<vis[i]<<' '<<vid<<el; } // cout<<el; } return 0; }

Compilation message (stderr)

game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:41:9: warning: unused variable 'c' [-Wunused-variable]
   41 |     int c=0;
      |         ^
#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...