Submission #1353041

#TimeUsernameProblemLanguageResultExecution timeMemory
1353041fateless코끼리 (Dancing Elephants) (IOI11_elephants)C++20
26 / 100
9091 ms1572 KiB
#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;
 
#define speedup cin.tie(0)->sync_with_stdio(0);
#define bitcount __builtin_popcount
#define all(x) begin(x), end(x)
#define pb push_back
#define vc vector

using ll = long long;
using pii = array<int, 2>;

mt19937 mt(chrono::steady_clock().now().time_since_epoch().count());
inline bool chmin(int &a, int b) {if (a > b) {a = b; return 1;} return 0;}
inline bool chmax(int &a, int b) {if (a < b) {a = b; return 1;} return 0;}

int n, l;
set<pii> st;
static int x[150010];
void init(int N, int L, int X[]) {
  n = N; l = L;
  for (int i = 0; i < n; i++) x[i] = X[i];
  for (int i = 0; i < n; i++) st.insert({x[i], i});
}

int update(int i, int y) {
  st.erase({x[i], i});
  x[i] = y;
  st.insert({x[i], i});

  int ans = 0;
  for (auto itr = begin(st); itr != end(st);) {
    auto [x, i] = *itr;
    auto nxt = st.upper_bound({x + l, n + 1});
    itr = nxt;
    ans++;
  }
  return ans;
}
/*
4 10 5
10
15
17
20
2 16 1
1 25 2
3 35 2
0 38 2
2 0 3
*/
#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...