답안 #823207

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
823207 2023-08-12T09:26:47 Z mindiyak 장난감 기차 (IOI17_train) C++14
0 / 100
5 ms 980 KB
#include "train.h"
#include <queue>
#include <iostream>
using namespace std;

vector<int> chargers;
vector<int> looped(1e4,0);
vector<int> can_move(1e4,0);
int N;

std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	N=a.size();
	for (int i = 0; i < u.size(); i++){
		if(u[i] == v[i])looped[u[i]]=1;
		if(u[i]+1 == v[i])can_move[u[i]]=1;
	}
	
	vector<int> ans(N,0);

	ans[N-1] = r[N-1] && looped[N-1];
	int can = ans[N-1];
	for(int i=N-2;i>=0;i--){
		if(r[i] && looped[i]){
			if(a[i])ans[i]=1;
			else{if(!can_move[i])ans[i]=1;}
		}
		if(can_move[i] && can){
			if(a[i])ans[i]=1;
			else{
				if(!looped[i])ans[i]=1;
			}
		}
		if(ans[i])can=1;
		if(!can_move[i])can=0;
	}

	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:13:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  for (int i = 0; i < u.size(); i++){
      |                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 596 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 980 KB Output is correct
2 Correct 4 ms 908 KB Output is correct
3 Correct 4 ms 904 KB Output is correct
4 Incorrect 4 ms 908 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 892 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 908 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 596 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -