This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "elephants.h"
#ifndef EVAL
#include "grader.cpp"
#endif
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define NeedForSpeed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Pi acos(-1);
#define mod 1e9+7
#define inf 1e18
typedef long long ll;
//#define int ll
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vii;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;}
template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;}
const int NN = 2e5+5;
int n, a[NN], l;
multiset<int> mm;
void init(int N, int L, int X[]){
n = N, l = L;
for(int i=0;i<n;i++){
a[i] = X[i];
mm.insert(a[i]);
}
}
int fun(int lx, int rx){
auto ttl = mm.lb(lx);
auto ttr = --mm.ub(rx);
if(ttl == ttr) return 0;
if(rx - lx+1 <= l) return 1;
int m = (lx + rx)>>1;
return fun(lx, m) + fun(m+1, rx);
}
int update(int i, int y){
mm.erase(mm.find(a[i]));
mm.insert(y);
a[i] = y;
int l = *mm.begin(), r = *mm.rbegin();
return fun(l, r);
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |