답안 #1060343

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1060343 2024-08-15T13:09:07 Z Zicrus 장난감 기차 (IOI17_train) C++17
11 / 100
602 ms 2136 KB
#include <bits/stdc++.h>
#include "train.h"
using namespace std;

typedef long long ll;

vector<vector<ll>> adj, revAdj;
vector<bool> vst;
bool poss = false;

void dfs1(ll cur, ll root) {
    vst[cur] = true;
    for (auto &e : revAdj[cur]) {
        if (e == root) poss = true;
        if (vst[e]) continue;
        dfs1(e, root);
    }
}

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
    ll n = a.size(), m = u.size();
	vector<int> res(n);
	adj = vector<vector<ll>>(n);
	revAdj = vector<vector<ll>>(n);
    for (int i = 0; i < m; i++) {
        adj[u[i]].push_back(v[i]);
        revAdj[v[i]].push_back(u[i]);
    }

    for (int i = 0; i < n; i++) {
        if (!r[i]) continue;
        vst = vector<bool>(n);
        poss = false;
        dfs1(i, i);
        if (poss) {
            for (int j = 0; j < n; j++) {
                if (!vst[j]) continue;
                res[j] = true;
            }
        }
    }

	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 94 ms 1348 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 33 ms 1884 KB Output is correct
2 Correct 56 ms 1896 KB Output is correct
3 Correct 67 ms 1880 KB Output is correct
4 Correct 211 ms 1828 KB Output is correct
5 Correct 45 ms 2136 KB Output is correct
6 Correct 8 ms 1884 KB Output is correct
7 Correct 198 ms 1900 KB Output is correct
8 Correct 5 ms 1884 KB Output is correct
9 Correct 4 ms 1572 KB Output is correct
10 Correct 5 ms 1824 KB Output is correct
11 Correct 5 ms 1572 KB Output is correct
12 Correct 5 ms 1628 KB Output is correct
13 Correct 5 ms 2060 KB Output is correct
14 Correct 5 ms 1884 KB Output is correct
15 Correct 6 ms 1884 KB Output is correct
16 Correct 5 ms 1884 KB Output is correct
17 Correct 6 ms 1884 KB Output is correct
18 Correct 93 ms 1372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 602 ms 1576 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1624 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 94 ms 1348 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -