# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
113140 | luciocf | Studentsko (COCI14_studentsko) | C++14 | 5 ms | 736 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.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e3+10;
int n;
int a[maxn], aux[maxn];
int lis(void)
{
vector<int> v;
for (int i = 1; i <= n; i++)
{
vector<int>::iterator it = upper_bound(v.begin(), v.end(), a[i]);
if (it == v.end())
v.push_back(a[i]);
else
*it = a[i];
}
return v.size();
}
int main(void)
{
int k;
scanf("%d %d", &n, &k);
for (int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
aux[i] = a[i];
}
sort(aux+1, aux+n+1);
map<int, int> group;
for (int i = 1; i <= n; i++)
group[aux[i]] = (i-1)/k;
for (int i = 1; i <= n; i++)
a[i] = group[a[i]];
printf("%d\n", n-lis());
}
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... |