답안 #72955

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72955 2018-08-27T09:50:04 Z SmsS 장난감 기차 (IOI17_train) C++14
5 / 100
13 ms 1064 KB
#include<bits/stdc++.h>
using namespace std;
#define for2(a,b,c) for(int a=b;a<c;a++)
#define ll long long
#include "train.h"

std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	std::vector<int> res(a.size());
	int n = a.size();
	int m = u.size();
	vector<bool> nxt(n);
	vector<bool> loop(n);
	for2(i,0,m){
		if(u[i] == v[i]) loop[v[i]] = 1;
		else nxt[u[i]] = 1;
	}
	for(int i = n-1; i >= 0; i--){
		if(r[i]){
			if(a[i]){
				if(loop[i]) res[i] = 1;
				else if(i!=n-1) res[i] = res[i+1];
			}else{
				if(nxt[i]) res[i] = res[i+1];
				else res[i] = 1;
			}
		}else{
			if(a[i]){
				if(nxt[i]) res[i] = res[i+1];
				else res[i] = 0;
			}else{
				if(loop[i]) res[i] = 0;
				else res[i] = res[i+1];
			}
		}
	}
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 9 ms 612 KB Output is correct
3 Correct 6 ms 612 KB Output is correct
4 Correct 8 ms 612 KB Output is correct
5 Correct 6 ms 704 KB Output is correct
6 Correct 7 ms 704 KB Output is correct
7 Correct 7 ms 704 KB Output is correct
8 Correct 7 ms 720 KB Output is correct
9 Correct 6 ms 904 KB Output is correct
10 Correct 5 ms 904 KB Output is correct
11 Correct 7 ms 904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 904 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1064 KB Output is correct
2 Correct 11 ms 1064 KB Output is correct
3 Correct 13 ms 1064 KB Output is correct
4 Incorrect 9 ms 1064 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1064 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1064 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 9 ms 612 KB Output is correct
3 Correct 6 ms 612 KB Output is correct
4 Correct 8 ms 612 KB Output is correct
5 Correct 6 ms 704 KB Output is correct
6 Correct 7 ms 704 KB Output is correct
7 Correct 7 ms 704 KB Output is correct
8 Correct 7 ms 720 KB Output is correct
9 Correct 6 ms 904 KB Output is correct
10 Correct 5 ms 904 KB Output is correct
11 Correct 7 ms 904 KB Output is correct
12 Incorrect 3 ms 904 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -