Submission #1000001

# Submission time Handle Problem Language Result Execution time Memory
1000001 2024-06-16T12:39:14 Z kym Toy Train (IOI17_train) C++14
0 / 100
323 ms 1372 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
vector<int>adj[MAXN];
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> U, std::vector<int> V) {
	int n = a.size();
	int e = U.size();
	for(int i=0;i<e;i++){
		adj[U[i]].push_back(V[i]);
		adj[V[i]].push_back(U[i]);
	}
	vector<int> res(n,0);
	for(int i=0;i<n;i++){
		if(r[i])res[i]=1;
	}
	for(int t=1;t<=n;t++){
		for(int i=0;i<n;i++){
			if(res[i] == 0){
				if(r[i] == 0){
					if(a[i]  == 0){
						bool bad = 0;
						for(auto x:adj[i]){
							if(r[x] == 0 && res[x] == 0)bad=1;
						}
						if(!bad)res[i]=1;
					} else{
						bool bad = 1;
						for(auto x:adj[i]){
							if(r[x] == 0 && res[x] == 0);
							else bad=0;
						}
						if(!bad)res[i]=1;
					}
				}
			}
		}
	}
	for(int t=1;t<=n;t++){
		for(int i=0;i<n;i++){
			if(res[i] == 1){
				if(a[i] == 0){
					bool good = 1;
					for(auto x:adj[i]){
						if(res[x] == 1);
						else good=0;
					}
					if(!good)res[i]=0;
				} else{
					bool good = 0;
					for(auto x:adj[i]){
						if(res[x]==1)good=1;
					}
					if(!good)res[i]=0;
				}
			}
		}
	}
	return res;

}
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 860 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 348 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 263 ms 1372 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 43 ms 1308 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 323 ms 1372 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 89 ms 860 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -