답안 #640651

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
640651 2022-09-15T05:00:11 Z ggoh 장난감 기차 (IOI17_train) C++14
5 / 100
8 ms 1432 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
#define sz(v) ((int)(v).size())
typedef long long lint;
typedef pair<int,int>pii;

int n,m,R[5005],A[5005];
vector<int>G[5005];
int D[5005];

int f(int p)
{
	if(D[p]>=0)return D[p];
	if(sz(G[p])==1)
	{
		if(G[p][0]==p)
		{
			if(R[p])return D[p]=1;
			else return D[p]=0;
		}
		else
		{
			return D[p]=f(p+1);
		}
	}
	else
	{
		if(A[p])
		{
			if(R[p])return D[p]=1;
			else return D[p]=f(p+1);
		}
		else
		{
			if(R[p])return D[p]=f(p+1);
			else return D[p]=0;
		}
	}
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	n=sz(a);
	m=sz(u);
	vector<int> res(n);
	for(int i=0;i<n;i++)
	{
		A[i]=a[i];
		R[i]=r[i];
	}
	for(int i=0;i<m;i++)G[u[i]].push_back(v[i]);
	memset(D,-1,sizeof(D));
	for(int i=0;i<n;i++)
	{
		res[i]=f(i);
	}

	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 820 KB Output is correct
2 Correct 4 ms 852 KB Output is correct
3 Correct 4 ms 820 KB Output is correct
4 Correct 4 ms 852 KB Output is correct
5 Correct 6 ms 824 KB Output is correct
6 Correct 4 ms 852 KB Output is correct
7 Correct 4 ms 852 KB Output is correct
8 Correct 6 ms 852 KB Output is correct
9 Correct 5 ms 844 KB Output is correct
10 Correct 4 ms 824 KB Output is correct
11 Correct 5 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 424 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1364 KB Output is correct
2 Correct 8 ms 1432 KB Output is correct
3 Correct 6 ms 1340 KB Output is correct
4 Incorrect 7 ms 1236 KB 3rd lines differ - on the 877th token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1120 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1208 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 820 KB Output is correct
2 Correct 4 ms 852 KB Output is correct
3 Correct 4 ms 820 KB Output is correct
4 Correct 4 ms 852 KB Output is correct
5 Correct 6 ms 824 KB Output is correct
6 Correct 4 ms 852 KB Output is correct
7 Correct 4 ms 852 KB Output is correct
8 Correct 6 ms 852 KB Output is correct
9 Correct 5 ms 844 KB Output is correct
10 Correct 4 ms 824 KB Output is correct
11 Correct 5 ms 852 KB Output is correct
12 Incorrect 1 ms 424 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -