Submission #711572

# Submission time Handle Problem Language Result Execution time Memory
711572 2023-03-17T08:54:34 Z penguinman Toy Train (IOI17_train) C++17
0 / 100
501 ms 1144 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){
				for(auto next: edge[i]){
					dp2[i] |= dp2[next];
				}
			}
			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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 164 ms 756 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 240 ms 1056 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 361 ms 920 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 501 ms 1144 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 164 ms 756 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -