Submission #426805

# Submission time Handle Problem Language Result Execution time Memory
426805 2021-06-14T09:59:31 Z oscar1f Toy Train (IOI17_train) C++17
0 / 100
890 ms 1232 KB
#include<bits/stdc++.h>
/*#include <cstdio>
#include <vector>
#include <cassert>
#include "train.h"*/
using namespace std;

const int MAX_GARE=5000;
int nbGare,nbChemin,nbBon;
vector<int> adja[MAX_GARE];
deque<int> aTraiter;
int dv[MAX_GARE];

vector<int> who_wins(vector<int> posses, vector<int> recharge, vector<int> dep, vector<int> arriv) {
	vector<int> rep;
	rep.clear();
	nbGare=posses.size();
	for (int i=0;i<nbGare;i++) {
		rep.push_back(0);
	}
	nbChemin=dep.size();
	for (int i=0;i<nbChemin;i++) {
		adja[dep[i]].push_back(arriv[i]);
	}
	for (int loop=0;loop<nbGare;loop++) {
		for (int i=0;i<nbGare;i++) {
			nbBon=0; 
			for (int ivois=0;ivois<adja[i].size();ivois++) {
				if (recharge[adja[i][ivois]]==1) {
					nbBon++;
				}
			}
			if (recharge[i]==1) {
				rep[i]=1;
			}
			else if (posses[i]==1 and nbBon>=1) {
				rep[i]=1;
				recharge[i]=1;
			}
			else if (nbBon==adja[i].size()) {
				rep[i]=1;
				recharge[i]=1;
			}
		}
	}
	return rep;
}
/*
int main() {
	int n, m;
	assert(2 == scanf("%d %d", &n, &m));

	vector<int> a(n), r(n), u(m), v(m);

	for(int i = 0; i < n; i++)
		assert(1 == scanf("%d", &a[i]));

	for(int i = 0; i < n; i++)
		assert(1 == scanf("%d", &r[i]));

	for(int i = 0; i < m; i++)
		assert(2 == scanf("%d %d", &u[i], &v[i]));

	vector<int> res = who_wins(a, r, u, v);

	for(int i = 0; i < (int)res.size(); i++)
		printf(i ? " %d" : "%d", res[i]);
	printf("\n");

	return 0;
}*/

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:28:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |    for (int ivois=0;ivois<adja[i].size();ivois++) {
      |                     ~~~~~^~~~~~~~~~~~~~~
train.cpp:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |    else if (nbBon==adja[i].size()) {
      |             ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 219 ms 760 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 332 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 368 ms 1044 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 347 ms 900 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 Correct 890 ms 1020 KB Output is correct
2 Correct 403 ms 1232 KB Output is correct
3 Correct 696 ms 1228 KB Output is correct
4 Correct 398 ms 1148 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Incorrect 225 ms 844 KB 3rd lines differ - on the 3730th token, expected: '0', found: '1'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 219 ms 760 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -