답안 #641113

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
641113 2022-09-16T02:29:46 Z ggoh 장난감 기차 (IOI17_train) C++14
11 / 100
132 ms 1236 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 0 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 132 ms 1076 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 852 KB Output is correct
2 Correct 11 ms 1176 KB Output is correct
3 Correct 9 ms 1204 KB Output is correct
4 Correct 7 ms 1236 KB Output is correct
5 Correct 67 ms 1236 KB Output is correct
6 Correct 107 ms 1220 KB Output is correct
7 Correct 53 ms 1108 KB Output is correct
8 Correct 10 ms 1200 KB Output is correct
9 Correct 6 ms 1160 KB Output is correct
10 Correct 7 ms 1200 KB Output is correct
11 Correct 6 ms 1236 KB Output is correct
12 Correct 6 ms 1236 KB Output is correct
13 Correct 11 ms 1236 KB Output is correct
14 Correct 9 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 996 KB Output is correct
2 Correct 7 ms 1236 KB Output is correct
3 Correct 8 ms 1236 KB Output is correct
4 Correct 7 ms 1108 KB Output is correct
5 Correct 1 ms 424 KB Output is correct
6 Correct 4 ms 884 KB Output is correct
7 Correct 5 ms 924 KB Output is correct
8 Incorrect 4 ms 980 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 -