제출 #470400

#제출 시각아이디문제언어결과실행 시간메모리
470400Yazan_AlattarRabbit Carrot (LMIO19_triusis)C++14
100 / 100
39 ms3980 KiB
#include <iostream> #include <fstream> #include <vector> #include <cstring> #include <algorithm> #include <set> #include <map> #include <queue> #include <utility> #include <cmath> #include <numeric> using namespace std; typedef long long ll; #define F first #define S second #define pb push_back #define endl "\n" #define all(x) x.begin(), x.end() const int M = 200007; const ll inf = 1e18; const ll mod = 1e9 + 7; const double pi = acos(-1); vector <ll> v; ll n, m; int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n >> m; v.pb(0); for(int i = 1; i <= n; ++i){ ll x; cin >> x; x = m * i - x; if(x < 0) continue; auto it = upper_bound(v.begin(), v.end(), x); if(it == v.end()) v.pb(x); else *it = x; } cout << n - v.size() + 1 << endl; return 0; } // Don't forget special cases. (n = 1?) // Look for the constraints. (Runtime array? overflow?)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...