Submission #301564

# Submission time Handle Problem Language Result Execution time Memory
301564 2020-09-18T04:30:20 Z TMJN Toy Train (IOI17_train) C++17
5 / 100
8 ms 1792 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;

int N,M;
vector<int>E[5000];

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++){
		E[u[i]].push_back(v[i]);
		assert(u[i]==v[i]||v[i]==u[i]+1);
	}
	vector<int>winner(N,0xE869120);
	for(int i=N-1;i>=0;i--){
		winner[i]=!a[i];
		for(int e:E[i]){
			if(a[i]==1&&r[i]==1&&e==i){
				winner[i]=1;
			}
			if(a[i]==1&&winner[e]==1){
				winner[i]=1;
			}
			if(a[i]==0&&r[i]==0&&e==i){
				winner[i]=0;
			}
			if(a[i]==0&&winner[e]==0){
				winner[i]=0;
			}
		}
	}
	return winner;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 872 KB Output is correct
2 Correct 5 ms 896 KB Output is correct
3 Correct 6 ms 896 KB Output is correct
4 Correct 5 ms 896 KB Output is correct
5 Correct 5 ms 896 KB Output is correct
6 Correct 5 ms 1024 KB Output is correct
7 Correct 5 ms 880 KB Output is correct
8 Correct 5 ms 896 KB Output is correct
9 Correct 5 ms 928 KB Output is correct
10 Correct 6 ms 896 KB Output is correct
11 Correct 4 ms 896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 768 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 1792 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 1536 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 1664 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 872 KB Output is correct
2 Correct 5 ms 896 KB Output is correct
3 Correct 6 ms 896 KB Output is correct
4 Correct 5 ms 896 KB Output is correct
5 Correct 5 ms 896 KB Output is correct
6 Correct 5 ms 1024 KB Output is correct
7 Correct 5 ms 880 KB Output is correct
8 Correct 5 ms 896 KB Output is correct
9 Correct 5 ms 928 KB Output is correct
10 Correct 6 ms 896 KB Output is correct
11 Correct 4 ms 896 KB Output is correct
12 Runtime error 1 ms 768 KB Execution killed with signal 11
13 Halted 0 ms 0 KB -