제출 #1266028

#제출 시각아이디문제언어결과실행 시간메모리
1266028thenpc장애물 (IOI25_obstacles)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "obstacles.h"
using namespace std;
#define ll long long
int n,m,cnt[200005],cnt1[200005];
bool check[200005]
void initialize(vector<int> t,vector<int> h){
   n=t.size();
   m=h.size();
   for(int i=0;i<m;i++){
     check[i]=false;
   }
  for(int i=0;i<m;i++){
    if(h[i]==0){
      check[i]=true;
      int r=i+1,l=i-1;
      while(true){
        if(l<0){
          break;
        }
        if(h[l]<=1){
          check[l]=true;
          l--;
        }
        else{
          break;
        }
      }
      while(true){
        if(r>=0){
          break;
        }
        if(h[r]<=1){
          check[r]=true;
          r++;
        }
        else{
          break;
        }
      }
      i=r;
    }
  }
  for(int i=0;i<m;i++){
    if(t[0]>h[i]){
      if(i==0){
        cnt[i]=0;
      }
      cnt[i]=cnt[i-1];
    }
    else{
      if(i==0){
        cnt[i]=1;
      }
      cnt[i]=cnt[i-1]+1;
    }
  }
  for(int i=0;i<m;i++){
    if(t[2]>h[i]){
      if(i==0){
        cnt1[i]=0;
      }
      cnt1[i]=cnt1[i-1];
    }
    else{
      if(i==0){
        cnt1[i]=1;
      }
      cnt1[i]=cnt1[i-1]+1;
    }
  }
}
bool can_reach(int l,int r,int s,int d){
  if(cnt[s]==cnt[d]){
    return true;
  }
  if(cnt1[s]==cnt1[d]&&check[s]&&check[d]){
    return true;
  }
  return false;
}

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

obstacles.cpp:7:1: error: expected initializer before 'void'
    7 | void initialize(vector<int> t,vector<int> h){
      | ^~~~
obstacles.cpp: In function 'bool can_reach(int, int, int, int)':
obstacles.cpp:77:24: error: 'check' was not declared in this scope
   77 |   if(cnt1[s]==cnt1[d]&&check[s]&&check[d]){
      |                        ^~~~~