답안 #593952

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593952 2022-07-11T17:59:09 Z FatihSolak 장난감 기차 (IOI17_train) C++17
11 / 100
1302 ms 25112 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 Correct 501 ms 20552 KB Output is correct
2 Incorrect 491 ms 20644 KB 3rd lines differ - on the 11th token, expected: '1', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 340 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 818 ms 19928 KB Output is correct
2 Correct 820 ms 21104 KB Output is correct
3 Correct 836 ms 21992 KB Output is correct
4 Incorrect 831 ms 25112 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 704 ms 23856 KB Output is correct
2 Correct 747 ms 24312 KB Output is correct
3 Correct 868 ms 24744 KB Output is correct
4 Correct 803 ms 24100 KB Output is correct
5 Correct 811 ms 23112 KB Output is correct
6 Correct 773 ms 22792 KB Output is correct
7 Correct 800 ms 23568 KB Output is correct
8 Correct 757 ms 23452 KB Output is correct
9 Correct 759 ms 24416 KB Output is correct
10 Correct 834 ms 24740 KB Output is correct
11 Correct 833 ms 24796 KB Output is correct
12 Correct 829 ms 24924 KB Output is correct
13 Correct 816 ms 24780 KB Output is correct
14 Correct 752 ms 24336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1302 ms 24496 KB Output is correct
2 Incorrect 1165 ms 24764 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 501 ms 20552 KB Output is correct
2 Incorrect 491 ms 20644 KB 3rd lines differ - on the 11th token, expected: '1', found: '0'
3 Halted 0 ms 0 KB -