제출 #1136388

#제출 시각아이디문제언어결과실행 시간메모리
1136388PlayVoltz학생 (COCI14_studentsko)C++20
100 / 100
37 ms556 KiB
#include <cstdio> #include <stdio.h> #include <stdbool.h> #include <iostream> #include <map> #include <vector> #include <climits> #include <stack> #include <string> #include <queue> #include <algorithm> #include <set> #include <unordered_set> #include <unordered_map> #include <cmath> #include <cctype> #include <bitset> #include <iomanip> #include <cstring> #include <numeric> #include <cassert> using namespace std; #define int long long #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin>>n>>k; vector<int> vect(n), dp(n, 0), f(n); for (int i=0; i<n; ++i)cin>>vect[i], f[i]=vect[i]; sort(f.begin(), f.end()); for (int i=0; i<n; ++i)vect[i]=(lower_bound(f.begin(), f.end(), vect[i])-f.begin())/k; for (int i=0; i<n; ++i){ dp[i]=1; for (int j=0; j<i; ++j)if (vect[j]<=vect[i])dp[i]=max(dp[i], dp[j]+1); } cout<<n-*max_element(dp.begin(), dp.end()); }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...