Submission #835772

# Submission time Handle Problem Language Result Execution time Memory
835772 2023-08-23T19:28:29 Z Josia Toy Train (IOI17_train) C++17
0 / 100
142 ms 1876 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) {
	assert(own[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 Runtime error 3 ms 1364 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 142 ms 1108 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 Runtime error 4 ms 1620 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1876 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1364 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -