답안 #417821

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
417821 2021-06-04T11:00:24 Z Hegdahl 장난감 기차 (IOI17_train) C++17
5 / 100
9 ms 1356 KB
#include <bits/stdc++.h>
#include "train.h"

using namespace std;

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

  bool case1 = true;
  for (int i = 0; i < m; ++i)
    if (u[i] != v[i] && u[i]+1 != v[i])
      case1 = false;

  if (case1) {
    vector<bool> can_nxt(n), can_self(n);
    for (int i = 0; i < m; ++i) {
      if (u[i] == v[i]) can_self[u[i]] = true;
      if (u[i]+1 == v[i]) can_nxt[u[i]] = true;
    }

    vector<int> inf_charge(n);
    for (int i = n-1; i >= 0; --i) {
      if (!can_nxt[i]) inf_charge[i] = r[i];
      else if (!can_self[i]) inf_charge[i] = inf_charge[i+1];
      else {
        if (a[i]) {
          inf_charge[i] = inf_charge[i+1] || r[i];
        } else {
          inf_charge[i] = inf_charge[i+1] && r[i];
        }
      }
    }

    return inf_charge;
  }

  cerr << "not subtask 1\n";
  assert(0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 588 KB Output is correct
2 Correct 4 ms 588 KB Output is correct
3 Correct 4 ms 460 KB Output is correct
4 Correct 4 ms 460 KB Output is correct
5 Correct 4 ms 460 KB Output is correct
6 Correct 4 ms 460 KB Output is correct
7 Correct 4 ms 460 KB Output is correct
8 Correct 4 ms 468 KB Output is correct
9 Correct 4 ms 460 KB Output is correct
10 Correct 4 ms 460 KB Output is correct
11 Correct 3 ms 432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 1356 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1120 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 1356 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 588 KB Output is correct
2 Correct 4 ms 588 KB Output is correct
3 Correct 4 ms 460 KB Output is correct
4 Correct 4 ms 460 KB Output is correct
5 Correct 4 ms 460 KB Output is correct
6 Correct 4 ms 460 KB Output is correct
7 Correct 4 ms 460 KB Output is correct
8 Correct 4 ms 468 KB Output is correct
9 Correct 4 ms 460 KB Output is correct
10 Correct 4 ms 460 KB Output is correct
11 Correct 3 ms 432 KB Output is correct
12 Runtime error 1 ms 332 KB Execution killed with signal 6
13 Halted 0 ms 0 KB -