Submission #152655

#TimeUsernameProblemLanguageResultExecution timeMemory
152655qkxwsmDancing Elephants (IOI11_elephants)C++14
26 / 100
9065 ms2936 KiB
#include "elephants.h" #include <bits/stdc++.h> using namespace std; template<class T, class U> void ckmin(T &a, U b) { if (a > b) a = b; } template<class T, class U> void ckmax(T &a, U b) { if (a < b) a = b; } #define MP make_pair #define PB push_back #define LB lower_bound #define UB upper_bound #define fi first #define se second #define FOR(i, a, b) for (auto i = (a); i < (b); i++) #define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--) #define SZ(x) ((int) ((x).size())) #define ALL(x) (x).begin(), (x).end() #define MAXN 150013 #define INF 1000000007 typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pii> vpi; typedef vector<pll> vpl; int N, L; int arr[MAXN]; set<int> vals; void init(int n, int l, int x[]) { N = n; L = l; FOR(i, 0, N) { arr[i] = x[i]; vals.insert(arr[i]); } } int update(int idx, int v) { vals.erase(arr[idx]); arr[idx] = v; vals.insert(arr[idx]); int ans = 0; int beg = -INF; for (auto it = vals.begin(); it != vals.end(); it++) { if (*it > beg + L) { beg = *it; ans++; } } return ans; }
#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...