Submission #391207

#TimeUsernameProblemLanguageResultExecution timeMemory
391207rocks03Dancing Elephants (IOI11_elephants)C++14
50 / 100
9012 ms1740 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define pb push_back #define SZ(x) ((int)(x).size()) #define all(x) x.begin(), x.end() #define debug(x) cout << #x << ": " << x << " " #define nl cout << "\n" #define rep(i, a, b) for(int i = (a); i < (b); i++) #define per(i, a, b) for(int i = (a); i >= (b); i--) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int *a, N, L; vector<int> st; void init(int n, int l, int X[]){ a = X, N = n, L = l; rep(i, 0, n) st.pb(X[i]); } int update(int i, int y){ st.erase(find(all(st), a[i])); a[i] = y; st.insert(upper_bound(all(st), a[i]), a[i]); int ans = 1, p = st[0]; rep(i, 1, N){ if(p + L < st[i]){ p = st[i], 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...