답안 #1037514

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037514 2024-07-29T02:33:01 Z sleepntsheep 장난감 기차 (IOI17_train) C++14
5 / 100
5 ms 880 KB
#include "train.h"

std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
    int n = a.size();
    int m = u.size();

    std::vector<int> loop(n), go(n);
    for (int i = 0; i < m; ++i)
        if (u[i] == v[i])
            loop[u[i]] = 1;
        else
            go[u[i]] = 1;

	std::vector<int> res(n);

    if (r[n-1])
        res[n-1] = 1;

    for (int i = n - 2; i >= 0; --i) {
        if (a[i]) {
            if (loop[i]) {
                if (r[i])
                    res[i] = 1;
                else {
                    if (go[i]) res[i] = res[i + 1];
                    else res[i] = 0;
                }
            } else res[i] = res[i + 1];
        } else {
            if (loop[i]) {
                if (r[i]) {
                    if (go[i]) res[i] = res[i + 1];
                    else res[i] = 1;
                }
                else res[i] = 0;
            } else res[i] = res[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:8:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    8 |     for (int i = 0; i < m; ++i)
      |     ^~~
train.cpp:14:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   14 |  std::vector<int> res(n);
      |  ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 692 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 2 ms 588 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 872 KB Output is correct
2 Correct 3 ms 860 KB Output is correct
3 Correct 3 ms 880 KB Output is correct
4 Incorrect 3 ms 860 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 604 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 856 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 692 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 2 ms 588 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Incorrect 1 ms 344 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -