Submission #711582

# Submission time Handle Problem Language Result Execution time Memory
711582 2023-03-17T09:17:15 Z penguinman Toy Train (IOI17_train) C++17
11 / 100
545 ms 1100 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+100){
		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;
			}
		}
	}
	rep(i,0,N) dp[i] = 1-dp[i];
	REP(t,0,N+100){
		rep(i,0,N){
			if(a[i] == 0){
				for(auto next: edge[i]){
					dp[i] |= dp[next];
				}
			}
			else{
				int val = 1;
				for(auto next: edge[i]){
					val &= dp[next];
				}
				dp[i] |= val;
			}
		}
	}
	rep(i,0,N) dp[i] = 1-dp[i];
	return dp;
}
# Verdict Execution time Memory Grader output
1 Incorrect 199 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 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB 3rd lines differ - on the 4th token, expected: '0', found: '1'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 305 ms 1100 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 Correct 351 ms 912 KB Output is correct
2 Correct 397 ms 972 KB Output is correct
3 Correct 464 ms 1028 KB Output is correct
4 Correct 461 ms 1004 KB Output is correct
5 Correct 446 ms 1012 KB Output is correct
6 Correct 444 ms 1000 KB Output is correct
7 Correct 455 ms 992 KB Output is correct
8 Correct 445 ms 980 KB Output is correct
9 Correct 417 ms 948 KB Output is correct
10 Correct 433 ms 1016 KB Output is correct
11 Correct 421 ms 1100 KB Output is correct
12 Correct 435 ms 1024 KB Output is correct
13 Correct 445 ms 1016 KB Output is correct
14 Correct 412 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 512 ms 1024 KB Output is correct
2 Correct 531 ms 1028 KB Output is correct
3 Correct 545 ms 1020 KB Output is correct
4 Correct 501 ms 972 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 204 ms 752 KB Output is correct
7 Correct 24 ms 752 KB Output is correct
8 Incorrect 25 ms 788 KB 3rd lines differ - on the 5th token, expected: '0', found: '1'
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 199 ms 756 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -