제출 #386911

#제출 시각아이디문제언어결과실행 시간메모리
386911Aldas25코끼리 (Dancing Elephants) (IOI11_elephants)C++14
26 / 100
9075 ms5892 KiB
#include "elephants.h" #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i <= (b); i++) const int MAXN = 500100; int n, l; set<int> pos; map<int, int> cnt; int x[MAXN]; void init(int N, int L, int X[]) { n = N; l = L; FOR(i, 0, N-1) { cnt[X[i]]++; pos.insert(X[i]); x[i] = X[i]; } } int update(int i, int y) { cnt[x[i]]--; if (cnt[x[i]] == 0) pos.erase(x[i]); x[i] = y; cnt[x[i]]++; pos.insert(x[i]); int lstSt = -l-5; int ret = 0; //cout << " --" << endl; for (int p : pos) { // cout << "p = " << p << endl; if (p > lstSt+l) { lstSt = p; ret++; // cout << " lstSt = " << p << endl; } } return ret; } /* 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...