Submission #139973

# Submission time Handle Problem Language Result Execution time Memory
139973 2019-08-01T18:39:47 Z shashwatchandra Toy Train (IOI17_train) C++17
11 / 100
1374 ms 26000 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define REP(i,n) for(int i = 0;i < n;i++)

const int N = 5001;

bool reach[N][N];
int n,m;
vector<int> adj[N];
int source = 0;

void dfs(int u){
	for(int v:adj[u]){
		if(reach[source][v])continue;
		reach[source][v] = 1;
		dfs(v);
	}
}

vector<int> who_wins(vector<int> a, vector<int> r,vector<int> u, vector<int> v) {
		n = a.size();
		m = u.size();
		REP(i,m){
			adj[u[i]].pb(v[i]);
		}
		while(source < n){
			dfs(source);
			source++;
		}
		vector<int> ans;
		REP(i,n){
			bool done = 0;
			REP(j,n){
				if(!r[j])continue;
				if(reach[i][j] and reach[j][j]){
					done = 1;
				}
			}
			ans.pb(done);
		}
		return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 392 ms 25072 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 2 ms 504 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 291 ms 25848 KB Output is correct
2 Correct 323 ms 25692 KB Output is correct
3 Correct 349 ms 25760 KB Output is correct
4 Correct 1339 ms 25848 KB Output is correct
5 Correct 1022 ms 25992 KB Output is correct
6 Correct 762 ms 25956 KB Output is correct
7 Correct 785 ms 25848 KB Output is correct
8 Correct 435 ms 25708 KB Output is correct
9 Correct 385 ms 25848 KB Output is correct
10 Correct 523 ms 25848 KB Output is correct
11 Correct 437 ms 25864 KB Output is correct
12 Correct 86 ms 25464 KB Output is correct
13 Correct 1328 ms 25976 KB Output is correct
14 Correct 1374 ms 26000 KB Output is correct
15 Correct 1369 ms 25948 KB Output is correct
16 Correct 1324 ms 25996 KB Output is correct
17 Correct 1353 ms 25976 KB Output is correct
18 Correct 581 ms 25596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1205 ms 25648 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1347 ms 25872 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 392 ms 25072 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -