제출 #1199100

#제출 시각아이디문제언어결과실행 시간메모리
1199100iamhereforfunGlobal Warming (CEOI18_glo)C++20
0 / 100
24 ms4680 KiB
// IamHereForFun // #include <bits/stdc++.h> using namespace std; #define LSOne(S) ((S) & -(S)) const int N = 2e5 + 5; const int M = 513; const int K = 4; const int LG = 20; const long long INF = -1e18; const int MOD = 1e9 + 7; const int B = 50; int n, d; multiset<int> st; void solve() { cin >> n >> d; for(int x = 0; x < n; x++) { int i; cin >> i; i -= x; auto it1 = st.lower_bound(i - d); auto it2 = st.upper_bound(i + d); if(it2 == st.end()) { st.insert(i + d); } else { st.erase(it2); } if(it1 != st.end()) { st.insert(*it1); } } cout << st.size(); } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; // cin >> t; for (int x = 1; x <= t; x++) { solve(); } return 0; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...