Submission #71024

# Submission time Handle Problem Language Result Execution time Memory
71024 2018-08-24T02:55:41 Z funcsr Toy Train (IOI17_train) C++17
0 / 100
17 ms 6568 KB
#include "train.h"
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <cassert>
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define INF (1LL<<60)
#define _1 first
#define _2 second
using namespace std;
typedef pair<int, int> P;

int N, M;
vector<int> G[100000];
vector<int> who_wins(vector<int> owner, vector<int> color, vector<int> U, vector<int> V) {
  N = owner.size(), M = U.size();
  vector<int> win(N);
  rep(i, M) G[U[i]].pb(V[i]), assert(V[i] == U[i] || V[i] == U[i]+1);
  for (int x=N-1; x>=0; x--) {
    bool loop = false;
    for (int t : G[x]) if (x == t) loop = true;
    //A
    if (owner[x] == 1) {
      if (color[x] && loop) win[x] = 1;
      else {
        if (x+1<N) win[x] = win[x+1];
        else win[x] = 0;
      }
    }
    else {
      if (!color[x] && loop) win[x] = 0;
      else {
        if (x+1<N) win[x] = win[x+1];
        else win[x] = 1;
      }
    }
  }
  return win;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2936 KB Output is correct
2 Correct 11 ms 3172 KB Output is correct
3 Incorrect 10 ms 3340 KB 3rd lines differ - on the 355th token, expected: '1', found: '0'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 5600 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 6424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 14 ms 6424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 6568 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2936 KB Output is correct
2 Correct 11 ms 3172 KB Output is correct
3 Incorrect 10 ms 3340 KB 3rd lines differ - on the 355th token, expected: '1', found: '0'
4 Halted 0 ms 0 KB -