제출 #1122513

#제출 시각아이디문제언어결과실행 시간메모리
1122513anarch_yRabbit Carrot (LMIO19_triusis)C++20
100 / 100
28 ms2244 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(x) begin(x), end(x) #define sz(x) (int)x.size() #define pb push_back int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<int> a(n); for(int i=0; i<n; i++) cin >> a[i]; reverse(all(a)); for(int i=0; i<n; i++){ a[i] += i*m; } vector<int> L; for(auto x: a){ int j = upper_bound(all(L), x) - begin(L); if(j == sz(L)) L.pb(x); else L[j] = x; } int j = upper_bound(all(L), n*m) - begin(L); int ans = n-j; cout << 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...