답안 #969300

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
969300 2024-04-24T22:34:04 Z mariaclara 장난감 기차 (IOI17_train) C++17
11 / 100
195 ms 1628 KB
#include "train.h"
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> pii;
const int INF = 1e9+10;
const ll LINF = 1e18+10;
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define mk make_pair
#define pb push_back
#define f first 
#define s second
 
int t;
bool vis[5005], in_dfs[5005];
vector<int> edges[5005];
 
bool dfs(int x, int raiz) {
	in_dfs[x] = 1;
	vis[x] = 1;
 
	for(auto viz : edges[x]) {
		if(viz == raiz) return 1;
		if(vis[viz]) continue;
		if(dfs(viz,raiz)) return 1;
	}
 
	in_dfs[x] = 0;
	return 0;
}
 
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	int n = sz(a), m = sz(u);
	vector<int> res(n);
 
	for(int i = 0; i < m; i++) edges[v[i]].pb(u[i]);
 
	queue<int> fila;
 
	for(int i = 0; i < n; i++) {
		if(r[i]) {
			memset(vis, 0, sizeof(vis));
			memset(in_dfs, 0, sizeof(in_dfs));
			if(dfs(i,i)) fila.push(i);
		}
	}
 
	while(!fila.empty()) {
		int x = fila.front();
		fila.pop();
 
		if(res[x]) continue;
		res[x] = 1;
 
		for(auto viz : edges[x])
			fila.push(viz);
	}
	
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 59 ms 1104 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 1496 KB Output is correct
2 Correct 57 ms 1372 KB Output is correct
3 Correct 62 ms 1372 KB Output is correct
4 Correct 68 ms 1364 KB Output is correct
5 Correct 36 ms 1336 KB Output is correct
6 Correct 9 ms 1628 KB Output is correct
7 Correct 142 ms 1380 KB Output is correct
8 Correct 5 ms 1372 KB Output is correct
9 Correct 5 ms 1116 KB Output is correct
10 Correct 6 ms 1372 KB Output is correct
11 Correct 6 ms 1116 KB Output is correct
12 Correct 5 ms 1116 KB Output is correct
13 Correct 5 ms 1372 KB Output is correct
14 Correct 5 ms 1628 KB Output is correct
15 Correct 7 ms 1472 KB Output is correct
16 Correct 5 ms 1624 KB Output is correct
17 Correct 6 ms 1572 KB Output is correct
18 Correct 96 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 195 ms 1116 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1112 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 59 ms 1104 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -