Submission #617928

# Submission time Handle Problem Language Result Execution time Memory
617928 2022-08-01T17:09:44 Z Ozy Toy Train (IOI17_train) C++17
5 / 100
9 ms 1364 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "

#define MAX 5000

std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {

    lli n,m;
    vector<lli> hijos[MAX];

	m = u.size();
	rep(i,0,m-1) hijos[u[i]].push_back(v[i]);

	n = a.size();
	vector<int> res;
	res.resize(n);

	rep(i,0,n-1) res[i] = a[i]^1;

	repa(i,n-1,0) {
        if (a[i] == 1) {
            for (auto h : hijos[i]) {
                if (h == i && r[i] == 1) res[i] = 1;
                else if (res[h] == 1) res[i] = 1;
            }
        }
        else {
            for (auto h : hijos[i]) {
                if (h == i && r[i] == 0) res[i] = 0;
                else if (res[h] == 0) res[i] = 0;
            }
        }
	}

	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 724 KB Output is correct
2 Correct 3 ms 852 KB Output is correct
3 Correct 3 ms 852 KB Output is correct
4 Correct 5 ms 724 KB Output is correct
5 Correct 4 ms 852 KB Output is correct
6 Correct 3 ms 724 KB Output is correct
7 Correct 3 ms 852 KB Output is correct
8 Correct 5 ms 724 KB Output is correct
9 Correct 4 ms 724 KB Output is correct
10 Correct 4 ms 724 KB Output is correct
11 Correct 3 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1364 KB Output is correct
2 Correct 5 ms 1236 KB Output is correct
3 Correct 5 ms 1216 KB Output is correct
4 Incorrect 6 ms 1332 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1156 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 9 ms 1340 KB 3rd lines differ - on the 3rd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 724 KB Output is correct
2 Correct 3 ms 852 KB Output is correct
3 Correct 3 ms 852 KB Output is correct
4 Correct 5 ms 724 KB Output is correct
5 Correct 4 ms 852 KB Output is correct
6 Correct 3 ms 724 KB Output is correct
7 Correct 3 ms 852 KB Output is correct
8 Correct 5 ms 724 KB Output is correct
9 Correct 4 ms 724 KB Output is correct
10 Correct 4 ms 724 KB Output is correct
11 Correct 3 ms 724 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Incorrect 1 ms 340 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
14 Halted 0 ms 0 KB -