답안 #794368

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
794368 2023-07-26T13:30:47 Z firewater 장난감 기차 (IOI17_train) C++14
5 / 100
17 ms 772 KB
#include "train.h"
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include <cassert>
#define ll long long
#define MX 5050
using namespace std;
int n,m,a[MX],c[MX],to[MX],toc[MX];
// void addl(int x,int y)
// {
// 	e[++tot].to=y;
// 	e[tot].nx=h[x];
// 	h[x]=tot;
// 	return;
// }
int dfs(int x)
{
	if(c[x]==0&&a[x]==0&&toc[x]==1)return 0;
	if(c[x]==1&&a[x]==1&&toc[x]==1)return 1;
	if(to[x])return dfs(x+1);
	else if(c[x]==0)return 0;
	else return 1;
}
std::vector<int> who_wins(std::vector<int> A, std::vector<int> C, std::vector<int> U, std::vector<int> V) {
	std::vector<int> ans(A.size());
	n=A.size();
	m=U.size();
	for(int i=1;i<=n;++i){
		a[i]=A[i-1];
		c[i]=C[i-1];
	}
	for(int i=0;i<m;++i){
		if(U[i]==V[i])toc[U[i]+1]=1;
		else to[U[i]+1]=1;
	}
		// addl(U[i]+1,V[i]+1);
	for(int i=1;i<=n;++i)
		ans[i-1]=dfs(i);
	return ans;
}



# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 772 KB Output is correct
2 Correct 11 ms 724 KB Output is correct
3 Correct 14 ms 772 KB Output is correct
4 Incorrect 16 ms 724 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 584 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 724 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Incorrect 0 ms 212 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -