# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
758298 | KN200711 | Studentsko (COCI14_studentsko) | C++14 | 12 ms | 340 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> arr(N), A(N);
for(int i=0;i<N;i++) {
scanf("%d", &arr[i]);
A[i] = arr[i];
}
sort(A.begin(), A.end());
int ans = 0;
for(int i=0;i<N/K;i++) {
int ls = A[N - (i + 1) * K];
int cnt = 0;
for(int c=arr.size() - 1;c>=0;c--) {
if(arr[c] >= ls) cnt++;
else break;
}
// cout<<i<<" "<<ls<<" "<<cnt<<endl;
ans += K - cnt;
vector<int> Y;
Y.clear();
for(int d=0;d<arr.size();d++) {
if(arr[d] < ls) Y.push_back(arr[d]);
}
arr = Y;
}
printf("%d\n", ans);
}
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... |