답안 #593301

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593301 2022-07-10T20:08:21 Z AlperenT 장난감 기차 (IOI17_train) C++17
0 / 100
5 ms 908 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]) isself[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++){
      |                 ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 468 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB 3rd lines differ - on the 9th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 852 KB Output is correct
2 Correct 5 ms 908 KB Output is correct
3 Incorrect 5 ms 852 KB 3rd lines differ - on the 3440th token, expected: '0', found: '1'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 724 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 852 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 468 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -