Submission #422097

# Submission time Handle Problem Language Result Execution time Memory
422097 2021-06-09T17:34:04 Z Antekb Toy Train (IOI17_train) C++14
12 / 100
385 ms 99608 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++){
		//cout<<uu[i]<<" "<<vv[i]<<"\n";
		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++){
				//cout<<i<<" "<<V[j]<<"\n";
				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]==0){
						V.pb(u);
					}
					//assert(d[u]>=0);
				}
			}
		}
	}
	int c=0;
	for(int i=0; i<n; i++)if(r[i])c=i;
	//cout<<c<<"\n";
	for(int i=0; i<n;i++){
		res[i]=czy[i][c]*czy[c][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:26:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |    for(int j=0; j<V.size(); j++){
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 15300 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 Correct 132 ms 99296 KB Output is correct
2 Correct 182 ms 99268 KB Output is correct
3 Correct 202 ms 99268 KB Output is correct
4 Correct 385 ms 99608 KB Output is correct
5 Correct 121 ms 89384 KB Output is correct
6 Incorrect 39 ms 44356 KB 3rd lines differ - on the 47th token, expected: '1', found: '0'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 4392 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 15 ms 12304 KB Output is correct
2 Correct 18 ms 21784 KB Output is correct
3 Correct 17 ms 17492 KB Output is correct
4 Correct 17 ms 21644 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 2636 KB Output is correct
8 Correct 7 ms 2252 KB Output is correct
9 Correct 7 ms 2320 KB Output is correct
10 Correct 2 ms 844 KB Output is correct
11 Correct 7 ms 4004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 15300 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -