Submission #954399

#TimeUsernameProblemLanguageResultExecution timeMemory
954399MaaxleDancing Elephants (IOI11_elephants)C++17
26 / 100
17 ms10584 KiB
#include <bits/stdc++.h> #define range(it, a, b) for (ll it = a; it < b; it++) #define all(x) begin(x), end(x) #define ll long long #define ull unsigned long long #define INF64 ((ll) 1 << 62) #define INF32 (1 << 30) #define mset multiset #define uset unordered_set #define umap unordered_map #define pqueue priority_queue #define ptr(A) shared_ptr<A> using namespace std; struct Ele { ll i, p; }; bool operator < (const Ele& a, const Ele& b) { if (a.p == b.p) return a.i < b.i; return a.p < b.p; } int n, l; multiset<Ele> ms; vector<ll> pos; void init(int N, int L, int X[]) { n = N; l = L; pos.resize(n); range(i, 0, n) { pos[i] = X[i]; ms.insert({i, pos[i]}); } } int update(int i, int y) { ms.erase({i, pos[i]}); pos[i] = y; ms.insert({i, pos[i]}); int nxt = 0; int cnt = 0; while (nxt <= (*ms.rbegin()).p) { // cout << "Covered all but the ones after: "; // cout << nxt << ' '; // cout << "Maximum is " << (*ms.rbegin()).p << '\n'; cnt++; auto lb = ms.lower_bound({0, nxt}); nxt = (*lb).p+l+1; if (cnt > 100) return -1; } cout << '\n'; 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...