답안 #775923

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
775923 2023-07-07T07:12:25 Z ttamx 장난감 기차 (IOI17_train) C++14
11 / 100
2000 ms 1708 KB
#include "train.h"
#include<bits/stdc++.h>

using namespace std;

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> U, vector<int> V) {
	int n=a.size();
    vector<int> ans(n,1);
    vector<vector<int>> adj(n),radj(n);
    for(int i=0;i<U.size();i++){
        int u=U[i],v=V[i];
        adj[u].emplace_back(v);
        radj[v].emplace_back(u);
    }
    for(int i=0;i<n;i++){
        if(r[i])continue;
        vector<bool> vis(n);
        function<void(int)> dfs=[&](int u){
            for(auto v:adj[u]){
                if(!vis[v]&&!r[v]){
                    vis[v]=true;
                    dfs(v);
                }
            }
        };
        dfs(i);
        if(!vis[i])continue;
        vector<bool> rvis(n);
        function<void(int)> rdfs=[&](int u){
            if(rvis[u])return;
            rvis[u]=true;
            ans[u]=0;
            for(auto v:radj[u])rdfs(v);
        };
        rdfs(i);
    }
	return ans;
}

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:10:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i=0;i<U.size();i++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 1236 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 194 ms 1708 KB Output is correct
2 Correct 238 ms 1708 KB Output is correct
3 Correct 280 ms 1680 KB Output is correct
4 Incorrect 1346 ms 1556 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1108 KB Output is correct
2 Correct 90 ms 1244 KB Output is correct
3 Correct 131 ms 1328 KB Output is correct
4 Correct 108 ms 1556 KB Output is correct
5 Correct 292 ms 1584 KB Output is correct
6 Correct 217 ms 1552 KB Output is correct
7 Correct 253 ms 1492 KB Output is correct
8 Correct 85 ms 1492 KB Output is correct
9 Correct 6 ms 1364 KB Output is correct
10 Correct 6 ms 1464 KB Output is correct
11 Correct 6 ms 1492 KB Output is correct
12 Correct 7 ms 1576 KB Output is correct
13 Correct 757 ms 1632 KB Output is correct
14 Correct 355 ms 1508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2076 ms 1496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 1236 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -