제출 #1130250

#제출 시각아이디문제언어결과실행 시간메모리
1130250sohamsen15코끼리 (Dancing Elephants) (IOI11_elephants)C++20
26 / 100
9089 ms3932 KiB
#pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 999999; int a[50005]; map<int, int> mp; int n, l; void init(int N, int L, int X[]) { n = N; l = L; for (int i = 0; i < n; i++) { a[i] = X[i]; mp[X[i]] = 1; } } int update(int idx, int y) { mp.erase(a[idx]); mp[y] = 1; a[idx] = y; int b[n]; int i = 0; for (auto x: mp) { b[i] = x.first; i++; } int ans = 0; for (int i = 0; i < n;) { ans++; bool done = false; for (int j = i + 1; j < n; j++) { if (b[j] - b[i] > l) { done = true; i = j; break; } else if (j == n - 1) { i = n; done = true; } } if (!done) i++; } 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...