제출 #988970

#제출 시각아이디문제언어결과실행 시간메모리
988970Otalp게임 (APIO22_game)C++17
30 / 100
4003 ms14164 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; #define pb push_back vector<int> q[200100], dq[200100]; int n, k; void init(int N, int K) { n = N; k = K; for(int i=0; i<n; i++){ q[i].clear(); dq[i].clear(); } for(int i=0; i<k-1; i++){ q[i].pb(i + 1); dq[i + 1].pb(i); } } int tin[200100], tout[200100]; int dp[200100], us[200100]; vector<int > ord; void dfs1(int v){ us[v] = 1; for(int to: q[v]){ if(us[to]) continue; dfs1(to); } ord.pb(v); } vector<int> comp; int col[200100]; void dfs2(int v){ us[v] = 1; comp.pb(v); for(int to: dq[v]){ if(us[to]) continue; dfs2(to); } } int add_teleporter(int u, int v) { q[u].pb(v); dq[v].pb(u); for(int i=0; i<n; i++){ us[i] = 0; col[i] = 0; } //for(int i=0; i<n; i++){ //cout<<i<<' '; //for(int to: dq[i]){ //cout<<to<<' '; //} //cout<<'\n'; //} ord.clear(); for(int i=0; i<n; i++){ if(us[i]) continue; dfs1(i); } //cout<<ord.size()<<'\n'; for(int i=0; i<n; i++){ us[i] = 0; } int ls = 0; for(int i=0; i<n; i++){ for(int to: q[i]){ if(to == i and i < k) return 1; } } for(int i=n-1; i>=0; i--){ if(us[ord[i]]) continue; comp.clear(); dfs2(ord[i]); int ls = 0; for(int h: comp){ //cout<<h<<' '; if(h < k) ls = 1; } //cout<<'\n'; if(comp.size() > 1 and ls) return 1; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:72:9: warning: unused variable 'ls' [-Wunused-variable]
   72 |     int ls = 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...