Submission #233424

#TimeUsernameProblemLanguageResultExecution timeMemory
233424crossing0verDancing Elephants (IOI11_elephants)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "elephants.h"
using namespace std;
int n,L,P[100000];

void init(int N, int L1, int X[])
{
  n = N; L = L1; 
  for (int i = 0; i < n; i++) P[i+1] = X[i],s.insert(X[i]);
  
}
multiset<int> s;

int update(int i, int y)
{
	i++;
  s.erase(s.find(P[i]));
  s.insert(y);
  P[i] = y;
  int last = INT_MIN,ans = 0;
  for (auto it = s.begin(); it != s.end(); it++) {
  	if (*it > last + L)
  		ans++, last = *it;
  }
  	
  return ans;
}

Compilation message (stderr)

elephants.cpp: In function 'void init(int, int, int*)':
elephants.cpp:9:45: error: 's' was not declared in this scope
   for (int i = 0; i < n; i++) P[i+1] = X[i],s.insert(X[i]);
                                             ^