Submission #127382

#TimeUsernameProblemLanguageResultExecution timeMemory
127382impriStudentsko (COCI14_studentsko)C++14
20 / 100
4 ms760 KiB
#include<bits/stdc++.h> using namespace std; int main(void){ios_base::sync_with_stdio(false);cin.tie(0); int n,k; vector<pair<int,int> >skills; int newarr[5000]; vector<int>temp; temp.push_back(-1); cin >> n >> k; for(int i=0;i<n;i++){ int a; cin >> a; skills.push_back(make_pair(a,i)); } sort(skills.begin(),skills.end()); for(int i=0;i<n;i++){ newarr[skills[i].second]=i/k; } for(int i=0;i<n;i++){ if(newarr[i]>=temp.back()) temp.push_back(newarr[i]); else *lower_bound(temp.begin(),temp.end(),newarr[i])=newarr[i]; } cout << n-(temp.size()-1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...