답안 #884383

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
884383 2023-12-07T09:14:47 Z abcvuitunggio 장난감 기차 (IOI17_train) C++17
11 / 100
8 ms 1884 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> ke[5001],ke2[5001],d;
int n,m,vis[5001],p[5001],sz[5001],ch[5001];
stack <int> st;
queue <int> q;
void dfs(int u){
    vis[u]=1;
    for (int v:ke[u])
        if (!vis[v])
            dfs(v);
    st.push(u);
}
void dfs2(int u){
    sz[p[u]]++;
    vis[u]=1;
    for (int v:ke2[u])
        if (!vis[v]){
            p[v]=p[u];
            dfs2(v);
        }
}
vector <int> who_wins(vector <int> a, vector <int> r, vector <int> u, vector <int> v){
    n=a.size(),m=u.size();
    for (int i=0;i<m;i++){
        if (u[i]==v[i])
            ch[u[i]]=1;
        ke[u[i]].push_back(v[i]);
        ke2[v[i]].push_back(u[i]);
    }
    for (int i=0;i<n;i++)
        if (!vis[i])
            dfs(i);
    iota(p,p+n,0);
    memset(vis,0,sizeof(vis));
    while (!st.empty()){
        int u=st.top();
        st.pop();
        if (!vis[u])
            dfs2(u);
    }
    d.assign(n,0);
    for (int i=0;i<n;i++){
        if (r[i]&&(sz[p[i]]>1||ch[i])){
            d[i]=1;
            q.push(i);
        }
    }
    while (!q.empty()){
        int u=q.front();
        q.pop();
        for (int v:ke2[u])
            if (!d[v]){
                d[v]=1;
                q.push(v);
            }
    }
    return d;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1372 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 604 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1628 KB Output is correct
2 Correct 5 ms 1628 KB Output is correct
3 Correct 7 ms 1620 KB Output is correct
4 Correct 6 ms 1624 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 6 ms 1624 KB Output is correct
7 Correct 6 ms 1628 KB Output is correct
8 Correct 6 ms 1596 KB Output is correct
9 Correct 6 ms 1628 KB Output is correct
10 Correct 6 ms 1628 KB Output is correct
11 Correct 6 ms 1728 KB Output is correct
12 Correct 5 ms 1628 KB Output is correct
13 Correct 6 ms 1884 KB Output is correct
14 Correct 6 ms 1884 KB Output is correct
15 Correct 6 ms 1884 KB Output is correct
16 Correct 6 ms 1852 KB Output is correct
17 Correct 8 ms 1852 KB Output is correct
18 Correct 4 ms 1464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1368 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1628 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1372 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -