Submission #646259

# Submission time Handle Problem Language Result Execution time Memory
646259 2022-09-29T10:35:19 Z jamezzz Toy Train (IOI17_train) C++17
11 / 100
566 ms 1272 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;

#define maxn 5005

typedef vector<int> vi;
bool vis[maxn],good[maxn];
vi AL[maxn];

vi who_wins(vi a,vi r,vi u,vi v){
	int n=a.size(),m=u.size();
	vi ans(n,0);
	for(int i=0;i<m;++i){
		AL[u[i]].push_back(v[i]);
	}
	for(int i=0;i<n;++i){
		if(r[i]==1)continue;
		for(int j=0;j<n;++j)vis[j]=false;
		queue<int> q;
		q.push(i);
		while(!q.empty()){
			int u=q.front();
			q.pop();
			if(good[i])continue;
			for(int v:AL[u]){
				if(r[v]==1)continue;
				if(v==i)good[i]=true;
				if(vis[v])continue;
				vis[v]=true;
				q.push(v);
			}
		}
	}
	for(int i=0;i<n;++i){
		bool take=false;
		for(int j=0;j<n;++j){
			for(int k:AL[j]){
				if(good[k]){
					good[j]=true;
					take=true;
					break;
				}
			}
		}
		if(!take)break;
	}
	for(int i=0;i<n;++i)ans[i]=!good[i];
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 852 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 424 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 172 ms 1256 KB Output is correct
2 Correct 83 ms 1272 KB Output is correct
3 Correct 46 ms 1248 KB Output is correct
4 Incorrect 304 ms 1252 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 235 ms 1064 KB Output is correct
2 Correct 341 ms 1140 KB Output is correct
3 Correct 233 ms 1244 KB Output is correct
4 Correct 53 ms 1204 KB Output is correct
5 Correct 566 ms 1236 KB Output is correct
6 Correct 516 ms 1216 KB Output is correct
7 Correct 533 ms 1200 KB Output is correct
8 Correct 169 ms 1188 KB Output is correct
9 Correct 269 ms 1152 KB Output is correct
10 Correct 10 ms 1260 KB Output is correct
11 Correct 7 ms 1236 KB Output is correct
12 Correct 7 ms 1236 KB Output is correct
13 Correct 442 ms 1248 KB Output is correct
14 Correct 398 ms 1164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 322 ms 1244 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 31 ms 852 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -