Submission #290884

# Submission time Handle Problem Language Result Execution time Memory
290884 2020-09-04T14:17:43 Z Kastanda Toy Train (IOI17_train) C++11
0 / 100
1937 ms 75192 KB
// M
#include<bits/stdc++.h>
#include "train.h"
using namespace std;
const int N = 5005;
int n, m, A[N], R[N];
vector < int > Adj[N];
bool dp[N * 3][N];

vector < int > who_wins(vector < int > _A, vector < int > _R, vector < int > _U, vector < int > _V)
{
        n = (int)_A.size();
        m = (int)_U.size();
        for (int i = 0; i < n; i ++)
                A[i] = _A[i];
        for (int i = 0; i < n; i ++)
                R[i] = _R[i];
        for (int i = 0; i < m; i ++)
        {
                Adj[_U[i]].push_back(_V[i]);
                Adj[_V[i]].push_back(_U[i]);
        }

        for (int i = 0; i < n; i ++)
                if (R[i]) dp[0][i] = 1;

        for (int k = 1; k <= n * 3; k ++)
        {
                for (int v = 0; v < n; v ++)
                {
                        if (A[v] == 1)
                        {
                                for (int u : Adj[v])
                                        dp[k][v] |= (dp[k - 1][u] | R[u]);
                        }
                        else
                        {
                                dp[k][v] = 1;
                                for (int u : Adj[v])
                                        dp[k][v] &= (dp[k - 1][u] | R[u]);
                        }
                }
        }
        vector < int > Rs;
        for (int i = 0; i < n; i ++)
        {
                int w = 0;
                for (int k = n * 2; k <= n * 3; k ++)
                        if (dp[k][i])
                                w = 1;
                Rs.push_back(w);
        }
        return Rs;
}
# Verdict Execution time Memory Grader output
1 Incorrect 974 ms 74620 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 640 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1738 ms 75140 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1587 ms 74960 KB 3rd lines differ - on the 16th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1937 ms 75192 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 974 ms 74620 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -