답안 #783512

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
783512 2023-07-15T02:12:08 Z vjudge1 장난감 기차 (IOI17_train) C++17
10 / 100
5 ms 1492 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> a, adj[16], r, stkp(16);
int sz;
int dfs(int n, int last_C) {
    if(stkp[n])
        return last_C >= stkp[n];
    stkp[n] = ++sz;
    if(r[n]) {
        last_C = sz;
    }
    bool res = !a[n];
    for(auto i: adj[n])
        if(dfs(i, last_C)^res) {
            res^=1;
            break;
        }
    stkp[n] = 0;
    sz--;
    return res;
}
std::vector<int> who_wins(std::vector<int> A, std::vector<int> R, std::vector<int> u, std::vector<int> v) {
    a=A;
    r=R;
    for(int i = 0; i < u.size(); i++) {
        adj[u[i]].push_back(v[i]);
    }
    vector<int> res;
    for(int i = 0; i < A.size(); i++)
        res.push_back(dfs(i,-1));
	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:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int i = 0; i < u.size(); i++) {
      |                    ~~^~~~~~~~~~
train.cpp:30:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for(int i = 0; i < A.size(); i++)
      |                    ~~^~~~~~~~~~
train.cpp:30:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |     for(int i = 0; i < A.size(); i++)
      |     ^~~
train.cpp:32:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   32 |  return res;
      |  ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 852 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 300 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 296 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 1492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1208 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 1472 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 852 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -