제출 #671692

#제출 시각아이디문제언어결과실행 시간메모리
671692Hacv16코끼리 (Dancing Elephants) (IOI11_elephants)C++17
컴파일 에러
0 ms0 KiB
#include "elephants.h"
#include<bits/stdc++.h>

typedef long long ll;
const int MAX = 2e6 + 15;

int n, l, x[MAX];
multiset<int> s;

void init(int n_, int l_, int x_[]){
  n = n_, l = l_;

  for(int i = 0; i < n; i++)
     x[i] = x_[i], s.insert(x[i]);
}

int update(int i, int y){
  s.erase(s.find(x[i]));
  s.insert(y);

  x[i] = y;

  int ans = 0, r = -1;
 
  for(auto x : s)
    if(x > r) ans++, r = x + l;

  return ans;
}

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

elephants.cpp:8:1: error: 'multiset' does not name a type
    8 | multiset<int> s;
      | ^~~~~~~~
elephants.cpp: In function 'void init(int, int, int*)':
elephants.cpp:14:20: error: 's' was not declared in this scope
   14 |      x[i] = x_[i], s.insert(x[i]);
      |                    ^
elephants.cpp: In function 'int update(int, int)':
elephants.cpp:18:3: error: 's' was not declared in this scope
   18 |   s.erase(s.find(x[i]));
      |   ^