제출 #758336

#제출 시각아이디문제언어결과실행 시간메모리
758336Unforgettablepl학생 (COCI14_studentsko)C++17
20 / 100
2 ms356 KiB
/* ID: samikgo1 TASK: LANG: C++ */ #include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; typedef pair<ll,ll> pll; #define all(x) x.begin(),x.end() #define allr(x) x.rbegin(),x.rend() #define f first #define s second //#define x first //#define y second const int INF = INT32_MAX; const ll modulo = 1e4; //#define int ll int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); // freopen("input.in","r",stdin); // freopen("haybales.out","w",stdout); int n,k; cin >> n >> k; vector<int> arr(n); for(int&i:arr)cin>>i; vector<int> arrsort = arr; sort(all(arrsort)); for(int&i:arr) { int index = lower_bound(all(arrsort),i)-arrsort.begin()+1; if(index%k)index = index/k +1; else index /= k; i = index; } vector<int> lis; for(int&i:arr){ if(lis.empty()){lis.emplace_back(i);continue;} if(i>=lis.back()){lis.emplace_back(i);continue;} *lower_bound(all(lis),i) = i; } cout << n-lis.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...
#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...