답안 #711569

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
711569 2023-03-17T08:50:42 Z penguinman 장난감 기차 (IOI17_train) C++17
0 / 100
516 ms 1064 KB
#include "train.h"
#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::vector;
using ll = int;
using vi = vector<ll>;
using vii = vector<vi>;
using std::string;
using pii = std::pair<ll,ll>;

#define rep(i,j,k) for(ll i=ll(j); i<ll(k); i++)
#define REP(i,j,k) for(ll i=ll(j); i<=ll(k); i++)
#define per(i,j,k) for(ll i=ll(j); i>=ll(k); i--)
#define ln "\n"
#define all(a) a.begin(), a.end()
#define mp std::make_pair
#define pb emplace_back

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();
	vii edge(N);
	rep(i,0,u.size()) edge[u[i]].pb(v[i]);
	vi dp = r;
	REP(t,0,N+10){
		rep(i,0,N){
			if(a[i] == 1){
				int val = 0;
				for(auto next: edge[i]){
					val |= dp[next];
				}
				dp[i] |= val;
			}
			else{
				int val = 1;
				for(auto next: edge[i]){
					val &= dp[next];
				}
				dp[i] = val;
			}
		}
	}
	vi dp2 = dp;
	rep(i,0,N) dp2[i] = 1-dp2[i];
	REP(t,0,N+10){
		rep(i,0,N){
			if(a[i] == 0){
				int val = 0;
				for(auto next: edge[i]){
					val |= dp2[next];
				}
				dp2[i] |= val;
			}
			else{
				int val = 1;
				for(auto next: edge[i]){
					val &= dp2[next];
				}
				dp2[i] = val;
			}
		}
	}
	rep(i,0,N) dp2[i] = 1-dp2[i];
	return dp2;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 214 ms 724 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 265 ms 1064 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 416 ms 912 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 516 ms 1052 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 214 ms 724 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -