Submission #835770

# Submission time Handle Problem Language Result Execution time Memory
835770 2023-08-23T19:26:48 Z Josia Toy Train (IOI17_train) C++17
0 / 100
794 ms 1180 KB
#include "train.h"
#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> graph;
vector<bool> own;
vector<bool> station;

vector<bool> vis;

void dfs(int v) {
	if (vis[v]) return;
	vis[v] = 1;

	for (int i: graph[v]) {
		dfs(i);
	}
}


vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	int n = a.size();
	graph.assign(n, vector<int>());
	for (int i = 0; i<(int)u.size(); i++) {
		graph[u[i]].push_back(v[i]);
	}
	own.resize(n);
	station.resize(n);
	for (int i = 0; i<n; i++) {
		own[i] = a[i];
		station[i] = r[i];
	}


	vector<int> res(n, 0);
	for (int i = 0; i<n; i++) {
		vis.assign(n, 0);
		dfs(i);
		for (int j = 0; j<n; j++) {
			if (station[j] && vis[j]) res[i] = 1;
		}
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 189 ms 924 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 140 ms 1180 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 643 ms 980 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 794 ms 1108 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 189 ms 924 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -