# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
878855 | KN200711 | Studentsko (COCI14_studentsko) | C++14 | 2 ms | 348 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;
int main() {
int N, K;
scanf("%d %d", &N, &K);
vector<int> A(N);
vector< pair<int, int> > arr(N);
for(int i=0;i<N;i++) {
scanf("%d", &A[i]);
arr[i] = make_pair(A[i], i);
}
sort(arr.begin(), arr.end());
for(int i=0;i<N;i++) {
A[arr[i].second] = i / K;
}
vector<int> Y;
Y.clear();
for(int i=0;i<N;i++) {
if(Y.size() == 0 || Y.back() <= A[i]) Y.push_back(A[i]);
else {
int V = upper_bound(Y.begin(), Y.end(), A[i]) - Y.begin();
Y[V] = A[i];
}
}
printf("%d\n", N - Y.size());
}
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... |