Submission #427007

# Submission time Handle Problem Language Result Execution time Memory
427007 2021-06-14T11:45:57 Z oscar1f Toy Train (IOI17_train) C++17
5 / 100
7 ms 748 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,deb;
int boucle[MAX_GARE],suiv[MAX_GARE];
int charge[MAX_GARE];
vector<int> rep;

vector<int> who_wins(vector<int> posses, vector<int> recharge, vector<int> dep, vector<int> arriv) {
	nbGare=posses.size();
	for (int i=0;i<nbGare;i++) {
		rep.push_back(0);
		charge[i]=recharge[i];
	}
	nbChemin=dep.size();
	for (int i=0;i<nbChemin;i++) {
		if (dep[i]==arriv[i]) {
			boucle[dep[i]]=1;
		}
		else {
			suiv[dep[i]]=1;
		}
	}
	for (int i=nbGare-1;i>=0;i--) {
		if (suiv[i]==1) {
			if (boucle[i]==0) {
				rep[i]=rep[i+1];
			}
			else {
				if (posses[i]==0) {
					rep[i]=min(charge[i],rep[i+1]);
				}
				else {
					rep[i]=max(charge[i],rep[i+1]);
				}
			}
		}
		else {
			rep[i]=charge[i];
		}
	}
	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;
}*/
# Verdict Execution time Memory Grader output
1 Correct 5 ms 588 KB Output is correct
2 Correct 5 ms 588 KB Output is correct
3 Correct 7 ms 588 KB Output is correct
4 Correct 5 ms 676 KB Output is correct
5 Correct 4 ms 588 KB Output is correct
6 Correct 6 ms 588 KB Output is correct
7 Correct 4 ms 588 KB Output is correct
8 Correct 4 ms 596 KB Output is correct
9 Correct 4 ms 588 KB Output is correct
10 Correct 4 ms 564 KB Output is correct
11 Correct 4 ms 568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 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 7 ms 748 KB Output is correct
2 Correct 6 ms 716 KB Output is correct
3 Correct 6 ms 716 KB Output is correct
4 Incorrect 6 ms 744 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 5 ms 716 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 744 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 5 ms 588 KB Output is correct
2 Correct 5 ms 588 KB Output is correct
3 Correct 7 ms 588 KB Output is correct
4 Correct 5 ms 676 KB Output is correct
5 Correct 4 ms 588 KB Output is correct
6 Correct 6 ms 588 KB Output is correct
7 Correct 4 ms 588 KB Output is correct
8 Correct 4 ms 596 KB Output is correct
9 Correct 4 ms 588 KB Output is correct
10 Correct 4 ms 564 KB Output is correct
11 Correct 4 ms 568 KB Output is correct
12 Incorrect 1 ms 204 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -