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"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define sz size()
const int N = 102;
ll n , l;
ll a[N];
void init(int N, int L, int X[])
{
n = N;
l = L;
for(int i = 0; i < n; i++) a[i] = X[i];
}
int update(int i, int y)
{
a[i] = y;
vector<ll> v;
for(int i = 0; i < n; i++) v.push_back(a[i]);
sort(v.begin(),v.end());
ll cnt = 1,dis=0;
for(int i = 1; i < n; i++)
{
//cout << v[i] << " ";
if(dis+v[i]-v[i-1]>l)
{
cnt++;
dis = 0;
}
else dis+=v[i]-v[i-1];
}
return cnt;
}
# | 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... |