Submission #1129863

#TimeUsernameProblemLanguageResultExecution timeMemory
1129863eirinayukariRabbit Carrot (LMIO19_triusis)C++20
100 / 100
27 ms5052 KiB
// author: miraiya #include <bits/stdc++.h> using namespace std; #define int long long #define FOR(i, l, r) for(int i = (l); i <= (r); i++) #define FOD(i, r, l) for(int i = (r); i >= (l); i--) #define fi first #define se second const int maxn = 1e6 + 10; const int mod = 1e9 + 7; signed main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); int n, m; vector<int> a; cin >> n >> m; FOR(i, 1, n) { int x; cin >> x; if(i * m - x >= 0) a.push_back(i * m - x); } vector<int> b; for(auto x : a) { int p = upper_bound(b.begin(), b.end(), x) - b.begin(); if(p == b.size()) b.push_back(x); else b[p] = x; } cout << n - b.size(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...