제출 #39114

#제출 시각아이디문제언어결과실행 시간메모리
39114mohammad_kilani장난감 기차 (IOI17_train)C++14
0 / 100
2000 ms14736 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; const int N = 5010; bitset < N > win[2][2 * N]; int n , m; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { n = a.size(); m = u.size(); vector<int> res; for(int i=0;i<n;i++) win[0][0][i] = r[i]; for(int i=1;i<=n;i++){ for(int j=0;j<n;j++) win[0][i][j] = (r[j] == 1 ? 1 : (a[j] ^ 1)); for(int j=0;j<m;j++){ if(r[u[j]]) continue; if(a[u[j]]){ if(win[0][i-1][v[j]] == 1) win[0][i][u[j]] = 1; } else{ if(win[0][i-1][v[j]] == 0) win[0][i][u[j]] = 0; } } } for(int i=0;i<n;i++) win[1][0][i] = win[0][n][i]; for(int i=1;i<=m;i++){ for(int j=0;j<n;j++) win[1][i][j] = (win[0][n][j] == 0 ? 0 : a[j] ^ 1); for(int j=0;j<m;j++){ if(a[u[j]]){ if(win[1][i-1][v[j]] == 1) win[1][i][u[j]] = 1; } else{ if(win[1][i-1][v[j]] == 0) win[1][i][u[j]] = 0; } } } for(int i=0;i<n;i++) res.push_back(win[1][m][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...