제출 #569147

#제출 시각아이디문제언어결과실행 시간메모리
569147Soumya1Rainforest Jumps (APIO21_jumps)C++17
컴파일 에러
0 ms0 KiB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
const int mxN = 2e5 + 5;
const int lg = 20;
int l[lg][mxN], r[lg][mxN], best[lg][mxN];
int h[mxN];
void init(int n, vector<int> H) {
  stack<int> s;
  for (int i = 0; i < n; i++) h[i + 1] = H[i];
  for (int i = 1; i <= n; i++) {
    while (!s.empty() && h[s.top()] <= h[i]) s.pop();
    l[0][i] = (s.empty() ? 0 : s.top());
    s.push(i);
  }
  while (!s.empty()) s.pop();
  for (int i = n; i >= 1; i--) {
    while (!s.empty() && h[s.top()] <= h[i]) s.pop();
    r[0][i] = (s.empty() ? 0 : s.top());
    s.push(i);
  }
  for (int i = 1; i <= n; i++) {
    best[0][i] = (h[l[0][i]] > h[r[0][i]] ? l[0][i] : r[0][i]);
  }
  h[0] = 1e9;
  for (int j = 1; j < lg; j++) {
    for (int i = 1; i <= n; i++) {
      l[j][i] = l[j - 1][l[j - 1][i]];
      r[j][i] = r[j - 1][r[j - 1][i]];
      best[j][i] = (h[l[j][i]] > h[r[j][i]] ? l[j][i] : r[j][i]);
    }
  }
}
int minimum_jumps(int a, int b, int c, int d) {
  int ans = 0;
  for (int j = lg - 1; j >= 0; j--) {
    if (h[best[j][a]] <= h[c]) {
      a = best[j][a];
      ans += (1 << j);
    }
  }
  for (int j = lg - 1; j >= 0; j--) {
    if (h[l[j][a]] <= h[c]) {
      a = l[j][a];
      ans += (1 << j);
    } else if (h[r[j][a]] <= h[c]) {
      a = r[j][a];
      ans += (1 << j);
    }
  }
  if (a == c) return ans;
  return -1;
  return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

jumps.cpp:1:10: fatal error: grader.h: No such file or directory
    1 | #include "grader.h"
      |          ^~~~~~~~~~
compilation terminated.