Submission #423007

# Submission time Handle Problem Language Result Execution time Memory
423007 2021-06-10T15:39:45 Z flappybird Toy Train (IOI17_train) C++14
23 / 100
327 ms 1892 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;
		if (!a[st]) {
			for (auto asdf : adj[st]) {
				if (!vis[asdf]) {
					c = 0;
					break;
				}
			}
		}
		else {
			c = 0;
			for (auto asdf : adj[st]) {
				if (vis[asdf]) {
					c = 1;
					break;
				}
			}
		}
		if (c) {
			for (i = 0; i < N; i++) res[i] |= vis[i];
		}
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 1356 KB 3rd lines differ - on the 26th 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 55 ms 1728 KB Output is correct
2 Correct 88 ms 1708 KB Output is correct
3 Correct 102 ms 1700 KB Output is correct
4 Correct 299 ms 1656 KB Output is correct
5 Correct 65 ms 1684 KB Output is correct
6 Correct 17 ms 1640 KB Output is correct
7 Correct 327 ms 1732 KB Output is correct
8 Correct 9 ms 1612 KB Output is correct
9 Correct 8 ms 1740 KB Output is correct
10 Correct 10 ms 1776 KB Output is correct
11 Correct 10 ms 1740 KB Output is correct
12 Correct 9 ms 1672 KB Output is correct
13 Correct 10 ms 1800 KB Output is correct
14 Correct 10 ms 1868 KB Output is correct
15 Correct 10 ms 1868 KB Output is correct
16 Correct 9 ms 1892 KB Output is correct
17 Correct 10 ms 1804 KB Output is correct
18 Correct 174 ms 1540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1532 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 12 ms 1652 KB Output is correct
2 Correct 9 ms 1620 KB Output is correct
3 Correct 9 ms 1612 KB Output is correct
4 Correct 9 ms 1484 KB Output is correct
5 Correct 1 ms 716 KB Output is correct
6 Correct 5 ms 1228 KB Output is correct
7 Correct 6 ms 1228 KB Output is correct
8 Correct 6 ms 1356 KB Output is correct
9 Correct 6 ms 1356 KB Output is correct
10 Correct 2 ms 844 KB Output is correct
11 Correct 6 ms 1416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 1356 KB 3rd lines differ - on the 26th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -