답안 #1000024

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000024 2024-06-16T13:24:44 Z kym 장난감 기차 (IOI17_train) C++14
11 / 100
198 ms 1380 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
vector<int>adj[MAXN];
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> U, std::vector<int> V) {
	int n = a.size();
	int e = U.size();
	for(int i=0;i<e;i++){
		adj[U[i]].push_back(V[i]);
		//adj[V[i]].push_back(U[i]);
	}
	vector<int> res(n,0);
	for(int i=0;i<n;i++){
		if(r[i])res[i]=1;
	}
	for(int t=1;t<=n;t++){
		for(int i=0;i<n;i++){
			if(res[i] == 0){
				if(r[i] == 0){
					if(a[i]  == 0){
						bool bad = 0;
						for(auto x:adj[i]){
							if(res[x] == 0)bad=1;
						}
						if(!bad)res[i]=1;
					} else{
						bool bad = 1;
						for(auto x:adj[i]){
							bad&=(res[x]==0);
						}
						if(!bad)res[i]=1;
					}
				}
			}
		}
	}
	
	for(int t=1;t<=n;t++){
		for(int i=0;i<n;i++){
			if(res[i] == 1){
				if(a[i] == 0){
					bool good = 1;
					for(auto x:adj[i]){
						if(res[x] == 1);
						else good=0;
					}
					if(!good)res[i]=0;
				} else{
					bool good = 0;
					for(auto x:adj[i]){
						if(res[x]==1)good=1;
					}
					if(!good)res[i]=0;
				}
			}
		}
	}
	return res;

}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 77 ms 856 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB 3rd lines differ - on the 4th token, expected: '0', found: '1'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 198 ms 1380 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 1116 KB Output is correct
2 Correct 109 ms 1116 KB Output is correct
3 Correct 104 ms 1372 KB Output is correct
4 Correct 70 ms 1368 KB Output is correct
5 Correct 120 ms 1116 KB Output is correct
6 Correct 123 ms 1328 KB Output is correct
7 Correct 121 ms 1112 KB Output is correct
8 Correct 93 ms 1112 KB Output is correct
9 Correct 88 ms 1272 KB Output is correct
10 Correct 107 ms 1372 KB Output is correct
11 Correct 116 ms 1368 KB Output is correct
12 Correct 106 ms 1368 KB Output is correct
13 Correct 121 ms 1368 KB Output is correct
14 Correct 115 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 134 ms 1372 KB Output is correct
2 Correct 125 ms 1372 KB Output is correct
3 Correct 131 ms 1372 KB Output is correct
4 Correct 120 ms 1280 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 79 ms 860 KB Output is correct
7 Correct 9 ms 1112 KB Output is correct
8 Incorrect 10 ms 1116 KB 3rd lines differ - on the 5th token, expected: '0', found: '1'
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 77 ms 856 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -