Submission #1037535

# Submission time Handle Problem Language Result Execution time Memory
1037535 2024-07-29T03:27:29 Z thinknoexit Toy Train (IOI17_train) C++17
0 / 100
471 ms 1316 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 5050;
vector<int> adj[N];
bool ans[N], vis[N];
int n, m, rt;
void dfs(int v) {
	vis[v] = 1;
	for (auto& x : adj[v]) {
		if (x == rt) {
			ans[v] = 1;
			continue;
		}
		if (!vis[x]) dfs(x);
		if (ans[x]) ans[v] = 1;
	}
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int>  _U, vector<int> _V) {
	n = a.size();
	m = _U.size();
	for (int i = 0;i < m;i++) {
		adj[_U[i]].push_back(_V[i]);
	}
	for (int i = 0;i < n;i++) {
		if (r[i]) {
			memset(vis, 0, sizeof vis);
			rt = i;
			dfs(i);
		}
	}
	{
		vector<int> _ans(n);
		for (int i = 0;i < n;i++) _ans[i] = ans[i];
		return _ans;
	}
}
/*
4 5
1 0 1 1
0 0 0 1
0 1
1 1
1 2
2 3
3 3
*/
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 1116 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 348 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1116 KB Output is correct
2 Correct 15 ms 1112 KB Output is correct
3 Correct 31 ms 1316 KB Output is correct
4 Incorrect 242 ms 1292 KB 3rd lines differ - on the 13th token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 471 ms 1120 KB 3rd lines differ - on the 21st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1112 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 66 ms 1116 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -