Submission #422916

# Submission time Handle Problem Language Result Execution time Memory
422916 2021-06-10T14:05:36 Z flappybird Toy Train (IOI17_train) C++14
0 / 100
268 ms 1836 KB
#include "train.h"

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")

using namespace std;
typedef int ll;

#define MAX 10000

vector<ll> A, s;
ll N, M;
vector<ll> adj[MAX], rev[MAX], deg, d;

std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	ll i;
	A = a;
	N = a.size();
	M = u.size();
	d.resize(N);
	deg.resize(N);
	vector<ll> res;
	res.resize(N);
	for (i = 0; i < N; i++) if (r[i]) s.push_back(i);
	for (i = 0; i < M; i++) adj[u[i]].push_back(v[i]), rev[v[i]].push_back(u[i]), d[u[i]]++;
	for (auto st : s) {
		deg = d;
		queue<ll> q;
		vector<ll> vis;
		vis.resize(N);
		q.push(st);
		vis[st] = 1;
		while (!q.empty()) {
			ll t = q.front();
			q.pop();
			for (auto x : rev[t]) {
				if (vis[x]) continue;
				deg[x]--;
				if (a[x]) q.push(x), vis[x] = 1;
				else if (deg[x] == 0) q.push(x), vis[x] = 1;
			}
		}
		bool c = true;
		for (auto asdf : adj[st]) {
			if (!vis[asdf]) {
				c = 0;
				break;
			}
		}
		if (c) {
			for (i = 0; i < N; i++) res[i] |= vis[i];
		}
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1356 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 1 ms 716 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 57 ms 1708 KB Output is correct
2 Correct 86 ms 1704 KB Output is correct
3 Correct 101 ms 1612 KB Output is correct
4 Correct 268 ms 1664 KB Output is correct
5 Correct 61 ms 1684 KB Output is correct
6 Incorrect 16 ms 1612 KB 3rd lines differ - on the 47th token, expected: '1', found: '0'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 1484 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 Correct 9 ms 1600 KB Output is correct
2 Correct 9 ms 1796 KB Output is correct
3 Correct 9 ms 1836 KB Output is correct
4 Correct 9 ms 1740 KB Output is correct
5 Correct 1 ms 716 KB Output is correct
6 Correct 5 ms 1356 KB Output is correct
7 Correct 5 ms 1356 KB Output is correct
8 Correct 7 ms 1484 KB Output is correct
9 Correct 6 ms 1392 KB Output is correct
10 Incorrect 2 ms 972 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1356 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -