Submission #669550

# Submission time Handle Problem Language Result Execution time Memory
669550 2022-12-06T17:30:19 Z someone Toy Train (IOI17_train) C++14
10 / 100
7 ms 1920 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
 
const int N = 10 + 42, INF = 1e9;
 
int n, m, dp[N*N][N];
vector<int> adj[N], ans;
 
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	n = a.size();
	m = u.size();
	for(int i = 0; i < m; i++)
        adj[u[i]].push_back(v[i]);
    
    for(int i = 0; i < n*n+42; i++) {
        for(int j = 0; j < n; j++) {
            if(a[j]) {
                for(int k : adj[j])
                    dp[i+1][j] = max(dp[i+1][j], dp[i][k]);
                if(r[j])
                    dp[i+1][j]++;
            } else {
                int mini = INF;
                for(int k : adj[j])
                    mini = min(mini, dp[i][k]);
                if(r[j])
                    mini++;
                if(mini >= INF) {
                    dp[i+1][j] = 0;
                } else {
                    dp[i+1][j] = mini;
                }
            }
	    }
	}
	
	for(int j = 0; j < n; j++)
	    ans.push_back((dp[n*n+42][j] > n));
	
	return ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1236 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 316 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 0 ms 316 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 1920 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1620 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 1876 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1236 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -