답안 #641116

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
641116 2022-09-16T02:45:31 Z ggoh 장난감 기차 (IOI17_train) C++14
11 / 100
152 ms 1140 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
#define sz(v) ((int)(v).size())
 
int n,m,ch[5005],is[2];
vector<int>G[5005],T;
void f(int p, vector<int> &a)
{
	while(1)
	{
		T.clear();
		for(int i=0;i<n;i++)
		{
			if(ch[i]!=p)
			{
				is[0]=is[1]=0;
				for(auto &k:G[i])
				{
					if(ch[k]==p)is[p]=1;
					else is[1-p]=1;
				}
				if((a[i]==p && is[a[i]]) || (a[i]!=p && !is[a[i]]))T.push_back(i);
			}
		}
		if(!sz(T))break;
		for(auto &k:T)ch[k]=p;
	}
}
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<m;i++)G[u[i]].push_back(v[i]);
	for(int i=0;i<n;i++)ch[i]=r[i];
	f(1,a);
	f(0,a);
	for(int i=0;i<n;i++)res[i]=ch[i];
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 724 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 1 ms 340 KB 3rd lines differ - on the 4th token, expected: '0', found: '1'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 152 ms 1068 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 832 KB Output is correct
2 Correct 9 ms 980 KB Output is correct
3 Correct 9 ms 980 KB Output is correct
4 Correct 9 ms 988 KB Output is correct
5 Correct 69 ms 1036 KB Output is correct
6 Correct 122 ms 980 KB Output is correct
7 Correct 53 ms 1100 KB Output is correct
8 Correct 10 ms 1140 KB Output is correct
9 Correct 7 ms 980 KB Output is correct
10 Correct 8 ms 980 KB Output is correct
11 Correct 8 ms 980 KB Output is correct
12 Correct 6 ms 1068 KB Output is correct
13 Correct 13 ms 992 KB Output is correct
14 Correct 10 ms 980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 980 KB Output is correct
2 Correct 7 ms 980 KB Output is correct
3 Correct 8 ms 980 KB Output is correct
4 Correct 7 ms 980 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 3 ms 724 KB Output is correct
7 Correct 6 ms 852 KB Output is correct
8 Incorrect 4 ms 852 KB 3rd lines differ - on the 5th token, expected: '0', found: '1'
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 724 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -