Submission #608625

# Submission time Handle Problem Language Result Execution time Memory
608625 2022-07-27T08:43:48 Z fvogel499 Toy Train (IOI17_train) C++17
0 / 100
1828 ms 1248 KB
#include "train.h"
#include <bits/stdc++.h>
 
using namespace std;
 
#define vi vector<int>
#define size(x) (int)((x).size())
 
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	int n = size(a);
    vi rg [n];
    for (int i = 0; i < size(u); i++) {
        rg[v[i]].push_back(u[i]);
    }
	int dp [n];
    for (int i = 0; i < n; i++) dp[i] = r[i];
    int sc = 0;
    for (int i : r) if (i) sc++;
    for (int _ = 0; _ < sc+5; _++) {
        for (int i = 0; i < n; i++) {
            vi to;
            for (int j : rg[i]) {
                to.push_back(dp[j]);
                if (r[j]) to.back()++;
            }
            if (to.empty()) continue;
            int use = to[0];
            if (a[i] == 0) {
                for (int j : to) {
                    use = min(use, j);
                }
            }
            else {
                for (int j : to) {
                    use = max(use, j);
                }
            }
            dp[i] = max(dp[i], use);
        }
    }
    vi win;
    for (int i = 0; i < n; i++) {
        win.push_back((dp[i] >= sc+1));
    }
    return win;
}
# Verdict Execution time Memory Grader output
1 Incorrect 693 ms 852 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 212 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 Incorrect 151 ms 1248 KB 3rd lines differ - on the 1663rd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1828 ms 1048 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 Incorrect 10 ms 1236 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 Incorrect 693 ms 852 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -