제출 #117725

#제출 시각아이디문제언어결과실행 시간메모리
117725Plurm장난감 기차 (IOI17_train)C++14
5 / 100
25 ms1280 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; vector<int> g[5005]; bool loop[5005]; bool rech[5005]; bool cont[5005]; bool dfs(int u){ if(cont[u]){ if(loop[u] && rech[u]) return true; if(!g[u].empty()) return dfs(u+1); else return false; }else{ if(loop[u] && !rech[u]) return false; if(!g[u].empty()) return dfs(u+1); else return true; } } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { // Subtask 1 int m = u.size(); for(int i = 0; i < m; i++){ if(u[i] == v[i]) loop[u[i]] = true; else g[u[i]].push_back(v[i]); } int n = a.size(); for(int i = 0; i < n; i++){ rech[i] = r[i] != 0; cont[i] = a[i] == 1; } vector<int> res; for(int i = 0; i < n; i++){ res.push_back(dfs(i)); } return res; }
#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...