Submission #593888

# Submission time Handle Problem Language Result Execution time Memory
593888 2022-07-11T17:16:55 Z FatihSolak Toy Train (IOI17_train) C++17
12 / 100
700 ms 1292 KB
#include "train.h"
#include <bits/stdc++.h>
#define N 5005
using namespace std;
long long dp[N];
long long ndp[N];
vector<int> adj[N];
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	int n = a.size();
	int m = u.size();
	for(int i = 0;i<m;i++){
		adj[u[i]].push_back(v[i]);
	}
	for(int i=0;i<2*n;i++){
		for(int j = 0;j<n;j++){
			if(a[j]){
				ndp[j] = -1e18;
				for(auto u:adj[j]){
					ndp[j] = max(ndp[j],dp[u] + r[j]*n - 1);
				}
			}
			else{
				ndp[j] = 1e18;
				for(auto u:adj[j]){
					ndp[j] = min(ndp[j],dp[u] + r[j]*n - 1);
				}
			}
		}
		for(int j = 0;j<n;j++){
			dp[j] = ndp[j];
		}
	}
	vector<int> res(n);
	for(int i = 0; i < n; i++){
		res[i] = (dp[i] > 0);
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 326 ms 812 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 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Incorrect 1 ms 340 KB 3rd lines differ - on the 5th token, expected: '0', found: '1'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 466 ms 1108 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 Correct 478 ms 960 KB Output is correct
2 Correct 543 ms 1100 KB Output is correct
3 Incorrect 638 ms 1100 KB 3rd lines differ - on the 108th token, expected: '0', found: '1'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 617 ms 1100 KB Output is correct
2 Correct 618 ms 1292 KB Output is correct
3 Correct 700 ms 1292 KB Output is correct
4 Correct 624 ms 1208 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 288 ms 896 KB Output is correct
7 Correct 30 ms 948 KB Output is correct
8 Correct 41 ms 1052 KB Output is correct
9 Correct 31 ms 1032 KB Output is correct
10 Correct 3 ms 596 KB Output is correct
11 Correct 51 ms 940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 326 ms 812 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -