Submission #422086

# Submission time Handle Problem Language Result Execution time Memory
422086 2021-06-09T17:23:55 Z Antekb Toy Train (IOI17_train) C++14
0 / 100
132 ms 99220 KB
#include "train.h"
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb(x) push_back(x)
using namespace std;
const int N=5005;
vector<int> E[N], rE[N];
int d[N];
int wsk=0;
int czy[N][N];
int vis[N];
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> uu, std::vector<int> vv) {
	int n=a.size(), m=uu.size();
	std::vector<int> res(n);
	for(int i=0; i<m; i++){
		E[uu[i]].pb(vv[i]);
		rE[vv[i]].pb(uu[i]);
	}
	for(int i=0; i<n; i++){
		if(r[i]){
			for(int j=0; j<n; j++)d[j]=E[j].size(), vis[j]=0;
			vector<int> V;
			V.push_back(i);
			for(int j=0; j<V.size(); j++){
				if(j)czy[V[j]][i]=1;
				if(V[j]==i && j!=0)continue;
				int v=V[j];
				for(int u:rE[v]){
					if(a[u] && !vis[u]){
						vis[u]=1;
						V.pb(u);
					}
					if(!a[u] && !--d[u]){
						V.pb(u);
					}
				}
			}
		}
	}
	int c=0;
	for(int i=0; i<n; i++)if(r[i])c=i;
	for(int i=0; i<res.size();i++){
		res[i]=czy[i][c];
	}
	return res;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |    for(int j=0; j<V.size(); j++){
      |                 ~^~~~~~~~~
train.cpp:43:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |  for(int i=0; i<res.size();i++){
      |               ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 15324 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 460 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 Incorrect 132 ms 99220 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 41 ms 4544 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 Correct 23 ms 12224 KB Output is correct
2 Correct 18 ms 21728 KB Output is correct
3 Correct 21 ms 17484 KB Output is correct
4 Correct 23 ms 21636 KB Output is correct
5 Correct 2 ms 716 KB Output is correct
6 Correct 7 ms 1228 KB Output is correct
7 Correct 6 ms 2672 KB Output is correct
8 Incorrect 6 ms 2252 KB 3rd lines differ - on the 5th token, expected: '0', found: '1'
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 15324 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -