답안 #593953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593953 2022-07-11T18:01:39 Z FatihSolak 장난감 기차 (IOI17_train) C++17
32 / 100
1266 ms 24968 KB
#include "train.h"
#include<cstdio>
#include<algorithm>
using namespace std;
	
int n, m, D[5010], TD[5010], U[5010];
bool edge[5010][5010];
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	n = a.size();
	m = u.size();
	int i, j, k;
	for(int i = 0;i<m;i++){
		edge[u[i]][v[i]] = 1;
	}
	for (i = 0; i < n; i++) {
		if (r[i] == 1)D[i] = 1;
		else D[i] = 0;
		if (a[i] == 1)TD[i] = 0;
		else TD[i] = 1e9;
	}
	for (i = 0; i < 10003; i++) {
		for (j = 0; j < m; j++) {
			if (a[u[j]] == 1 && !(a[v[j]] == 0 && r[v[j]] == 0 && edge[v[j]][v[j]])) {
				TD[u[j]] = max(TD[u[j]], r[u[j]] + D[v[j]]);
			}
			else {
				TD[u[j]] = min(TD[u[j]], r[u[j]] + D[v[j]]);
			}
		}
		for (j = 0; j < n; j++) {
			if (i == 5002)U[j] = TD[j];
			D[j] = TD[j];
			if (a[j] == 1)TD[j] = 0;
			else TD[j] = 1e9;
		}
	}
	vector<int>res(n);
	for (j = 0; j < n; j++) {
		if (D[j] != U[j])res[j] = 1;
		else res[j] = 0;
	}
	return res;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:11:12: warning: unused variable 'k' [-Wunused-variable]
   11 |  int i, j, k;
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 479 ms 20548 KB 3rd lines differ - on the 50th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 4 ms 300 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 2 ms 292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 731 ms 20036 KB Output is correct
2 Correct 724 ms 21008 KB Output is correct
3 Correct 745 ms 21780 KB Output is correct
4 Correct 775 ms 24904 KB Output is correct
5 Correct 803 ms 24856 KB Output is correct
6 Correct 796 ms 24700 KB Output is correct
7 Correct 796 ms 24236 KB Output is correct
8 Correct 778 ms 23132 KB Output is correct
9 Correct 710 ms 21948 KB Output is correct
10 Correct 748 ms 23384 KB Output is correct
11 Correct 716 ms 23052 KB Output is correct
12 Correct 676 ms 24508 KB Output is correct
13 Correct 765 ms 24860 KB Output is correct
14 Correct 772 ms 24756 KB Output is correct
15 Correct 780 ms 24872 KB Output is correct
16 Correct 785 ms 24908 KB Output is correct
17 Correct 776 ms 24968 KB Output is correct
18 Correct 420 ms 23680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 578 ms 23832 KB Output is correct
2 Correct 660 ms 24288 KB Output is correct
3 Correct 758 ms 24616 KB Output is correct
4 Correct 761 ms 24076 KB Output is correct
5 Correct 768 ms 22856 KB Output is correct
6 Correct 725 ms 22656 KB Output is correct
7 Correct 733 ms 23328 KB Output is correct
8 Correct 720 ms 23228 KB Output is correct
9 Correct 673 ms 24272 KB Output is correct
10 Correct 759 ms 24724 KB Output is correct
11 Correct 760 ms 24692 KB Output is correct
12 Correct 767 ms 24680 KB Output is correct
13 Correct 774 ms 24568 KB Output is correct
14 Correct 704 ms 24396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1266 ms 24496 KB 3rd lines differ - on the 869th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 479 ms 20548 KB 3rd lines differ - on the 50th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -