Submission #584667

# Submission time Handle Problem Language Result Execution time Memory
584667 2022-06-27T18:47:56 Z 1ne Toy Train (IOI17_train) C++14
0 / 100
8 ms 1004 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	int n = (int)a.size();
	int m = (int)u.size();
	vector<int>ans(n);
	vector<vector<int>>adj(n);
	for (int i = 0;i<m;++i){
		adj[u[i]].push_back(v[i]);
	}
	vector<bool>visited(n,false);
	vector<int>cnt(n,0);
	function<int(int,int)>dfs = [&](int u,int got){
		visited[u] = true;
		int ans = 0;
		for (auto x:adj[u]){
			if (visited[u] && got){
				ans = 1;
				break;
			}
			else if (visited[u]){
				continue;
			}
			ans|=dfs(x,(got|(r[u] == 1)));
		}
		return cnt[u] = ans;
	};
	for (int i = 0;i<n;++i){
		if (visited[i]){
			ans[i] = cnt[i];
		}
		else{
			ans[i] = dfs(i,0);
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 724 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
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 Correct 8 ms 1004 KB Output is correct
2 Correct 5 ms 980 KB Output is correct
3 Correct 6 ms 980 KB Output is correct
4 Incorrect 7 ms 980 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 832 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 6 ms 1000 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 3 ms 724 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -