Submission #296618

# Submission time Handle Problem Language Result Execution time Memory
296618 2020-09-10T17:27:17 Z Dovran Toy Train (IOI17_train) C++11
0 / 100
14 ms 3072 KB
#include <bits/stdc++.h>
#include "train.h"

#define N 20009
#define pii pair <int, int>
#define ff first
#define ss second
#define sz() size()
#define pb push_back
#define ll long long

using namespace std;

bool a[N];
vector<int>ans;
int asd=0;
int vis[N], c[N];
map<int, int>M[N];

void dfs(int nd){
	vis[nd]=1;
	if(a[nd]){
		asd=1;
		return;
	}
	if(M[nd][nd+1] and !vis[nd+1])
		dfs(nd+1);
	a[nd]=asd;
}

std::vector<int> who_wins(std::vector<int>o, std::vector<int>p, std::vector<int>u, std::vector<int>v){
	int n=o.sz();
	int m=u.sz();
	for(int i=0; i<m; i++){
		M[u[i]][v[i]]=1;
		if(u[i]==v[i])
			c[u[i]]=1;
	}
	for(int i=0; i<n; i++)
		if(p[i]==1 and o[i]==1 and c[i]==1)
			a[i]=1;
	for(int i=0; i<n; i++){
		if(!a[i] and !vis[i])
			asd=0, dfs(i);
		
		ans.pb(a[i]);
	}
	return ans;
}
/*
int main(){
	int n, m;
	vector<int>o, p, u, v;
	int x;
	cin>>n>>m;
	for(int i=0; i<n; i++)
		cin>>x, o.pb(x);
	for(int i=0; i<n; i++)
		cin>>x, p.pb(x);
	for(int i=0; i<m; i++)
		cin>>x, u.pb(x);
	for(int i=0; i<m; i++)
		cin>>x, v.pb(x);
	vector<int>ans=who_wins(o, p, u, v);
	for(auto i:ans)
		cout<<i<<' ';
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1920 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 1280 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 11 ms 3072 KB Output is correct
2 Correct 11 ms 3072 KB Output is correct
3 Correct 11 ms 3072 KB Output is correct
4 Incorrect 12 ms 3072 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 Incorrect 10 ms 2688 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 14 ms 3072 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 6 ms 1920 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -