# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
200555 | Kalam | Studentsko (COCI14_studentsko) | C++11 | 8 ms | 892 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// KALAM
# include<bits/stdc++.h>
# define debug(x) cerr << #x << " = " << x << endl
using namespace std;
const int N = 100000 + 77;
int A , n , k , a[N] , F[N];
vector < int > U;
int main() {
memset(F , 63 , sizeof F);
scanf("%d %d" , & n , & k);
for(int i = 1;i <= n;++ i)
scanf("%d" , a + i) , U.push_back(a[i]);
sort(U.begin() , U.end());
U.resize(unique(U.begin() , U.end()) - U.begin());
for(int i = 1;i <= n;++ i)
a[i] = (lower_bound(U.begin() , U.end() , a[i]) - U.begin()) / k + 1;
F[0] = -1;
for(int i = 1;i <= n;++ i) {
int id = upper_bound(F , F + n + 2 , a[i]) - F;
F[id] = a[i];
A = max(A , id);
}
printf("%d\n" , n - A);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |