Submission #584713

# Submission time Handle Problem Language Result Execution time Memory
584713 2022-06-27T21:36:48 Z 1ne Toy Train (IOI17_train) C++14
0 / 100
71 ms 1700 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,0);
	vector<vector<int>>adj(n),adj2(n);
	for (int i = 0;i<m;++i){
		adj[u[i]].push_back(v[i]);
		adj2[v[i]].push_back(u[i]);
	}
	vector<bool>visited(n,false),visited2(n,false);
	function<void(int)>dfs = [&](int u){
		visited[u] = true;
		for (auto x:adj[u]){
			if (!visited[x])dfs(x);
		}
	};	
	function<void(int)>dfs2 = [&](int u){
		visited2[u] = true;
		for (auto x:adj2[u]){
			if (!visited2[x])dfs2(x);
		}
	};	
	for (int i = 0;i<n;++i){
		for (int j = 0;j<n;++j){
			visited[i] = false;
			visited2[i] = false;
		}
		for (auto x:adj[i])dfs(x);
		for (auto x:adj2[i])dfs2(x);
		if (visited[i]){
			for (int j = 0;j<n;++j){
				ans[j] |=visited2[j];
			}
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 1236 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 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 71 ms 1700 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 68 ms 1236 KB 3rd lines differ - on the 521st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 1492 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 1236 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -