Submission #593302

# Submission time Handle Problem Language Result Execution time Memory
593302 2022-07-10T20:09:42 Z AlperenT Toy Train (IOI17_train) C++17
5 / 100
5 ms 852 KB
#include <bits/stdc++.h>
#include "train.h"

using namespace std;

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v){
	int n = a.size();

	vector<bool> isself(n), isnext(n);

	for(int i = 0; i < u.size(); i++){
		if(u[i] == v[i]) isself[u[i]] = true;
		else if(u[i] + 1 == v[i]) isnext[u[i]] = true;
	}

	vector<int> ans(n);

	for(int i = n - 1; i >= 0; i--){
		if(a[i]){
			if(isself[i] && r[i]) ans[i] = true;
			if(isnext[i] && ans[i + 1]) ans[i] = true;
		}
		else{
			ans[i] = true;

			if(isself[i] && !r[i]) ans[i] = false;
			if(isnext[i] && !ans[i + 1]) ans[i] = false;
		}
	}

	return ans;
}

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:11:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |  for(int i = 0; i < u.size(); i++){
      |                 ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 3 ms 568 KB Output is correct
3 Correct 3 ms 476 KB Output is correct
4 Correct 3 ms 568 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 3 ms 564 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 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 5 ms 596 KB Output is correct
2 Correct 5 ms 596 KB Output is correct
3 Correct 4 ms 596 KB Output is correct
4 Incorrect 5 ms 852 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 4 ms 596 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 5 ms 596 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 Correct 2 ms 468 KB Output is correct
2 Correct 3 ms 568 KB Output is correct
3 Correct 3 ms 476 KB Output is correct
4 Correct 3 ms 568 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 3 ms 564 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
12 Incorrect 0 ms 212 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
13 Halted 0 ms 0 KB -