Submission #963637

#TimeUsernameProblemLanguageResultExecution timeMemory
963637AmrDancing Elephants (IOI11_elephants)C++17
26 / 100
12 ms9760 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...