# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
85925 | memetkagan44 | Studentsko (COCI14_studentsko) | C++11 | 6 ms | 1956 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 n,k,ar[5001];
vector<int> ans;
vector<pair<int,int> > v;
int main(){
scanf("%d %d",&n,&k);
for(int i=0;i<n;i++){
scanf("%d",&ar[i]);
v.push_back(make_pair(ar[i],i));
}
sort(v.begin(),v.end());
for(int i=0;i<n;i++)
ar[v[i].second]=(i/k)+1;
ans.push_back(-0x3f3f3f3f);
for(int i=0;i<n;i++){
vector<int>::iterator it=upper_bound(ans.begin(),ans.end(),ar[i]);
if(it==ans.end())
ans.push_back(ar[i]);
else
*it=ar[i];
}
printf("%d\n",n+1-ans.size());
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... |