제출 #1045786

#제출 시각아이디문제언어결과실행 시간메모리
1045786LittleOrange장난감 기차 (IOI17_train)C++17
0 / 100
4 ms1592 KiB
#include "train.h" #include<bits/stdc++.h> using namespace std; using ll = int; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { ll n = a.size(); ll m = u.size(); std::vector<int> res(a.size()); for(int i = 0; i < (int)res.size(); i++) res[i] = i % 2; vector<vector<ll>> con(n),rcon(n); for(ll i = 0;i<m;i++){ con[u[i]].push_back(v[i]); rcon[v[i]].push_back(u[i]); } vector<ll> ans(n,0); vector<ll> st; for(ll i = 0;i<n;i++) if(r[i]) st.push_back(i); while(st.size()){ ll i = st.back();st.pop_back(); if (ans[i]) continue; ans[i] = 1; for(ll j : con[i]) st.push_back(j); } return ans; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...