제출 #117677

#제출 시각아이디문제언어결과실행 시간메모리
117677Plurm장난감 기차 (IOI17_train)C++14
0 / 100
1010 ms1400 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; vector<int> g[5005]; int par[5005]; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { // Subtask 3 int m = u.size(); for(int i = 0; i < m; i++){ g[u[i]].push_back(v[i]); } int n = a.size(); vector<int> res(n); for(int i = 0; i < n; i++){ memset(par, -1, sizeof(par)); queue<int> q; q.push(i); par[i] = i; while(!q.empty()){ int cur = q.front(); q.pop(); for(int nxt : g[cur]){ if(par[nxt] == -1){ par[nxt] = cur; q.push(nxt); } } } bool ok = false; for(int j = 0; j < n; j++){ if(r[j]){ if(par[j] != -1) ok = true; } } res[i] = ok ? 1 : 0; } 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...