Submission #591231

#TimeUsernameProblemLanguageResultExecution timeMemory
591231bLICRabbit Carrot (LMIO19_triusis)C++17
0 / 100
1 ms300 KiB
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) (int)(x).size() #define ft first #define sd second #define pb push_back #define endl '\n' typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vii; typedef vector<ll> vl; typedef vector<pair<ll, ll>> vll; #define dgb if(0) const ll MOD = 1e18; const int INF = 1e9; void solve(){ int n, m; cin>>n>>m; ll a[n]; for (int i = 0;i<n;i++){ cin>>a[i]; a[i] = m*(i+1)-a[i]; } multiset<int> s; for (int x:a){ if (x<0) continue; auto it = s.lower_bound(x); if (it!=s.end()){ s.erase(it); } s.insert(x); } cout<<n-s.size(); } int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); // cout.tie(NULL); int t=1; // cin>>t; while(t--){ solve(); cout<<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...