Submission #781610

# Submission time Handle Problem Language Result Execution time Memory
781610 2023-07-13T08:37:12 Z Dakto Dancing Elephants (IOI11_elephants) C++17
0 / 100
2 ms 468 KB
#include <bits/stdc++.h>

using namespace std;

#include "elephants.h"

int n;
int l;

vector<int> v;
vector<int> ind;

void init(int N, int L, int X[])
{
  n = N;
  l=L;
  for(int i=0; i<n; i++){
      v.push_back(X[i]);
      ind[i]=X[i];
  }
  sort(v.begin(), v.end());
}

int update(int i, int y)
{
    v.erase(lower_bound(v.begin(), v.end(), ind[i]));
    ind[i]=y;
    v.insert(lower_bound(v.begin(), v.end(), ind[i]), ind[i]);
    int res=0;

    long long last=-100000000;
    for(auto i:v){
        if(i>last){
            last=i+l;
            res++;
        }
    }
    return res;
}

# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -