Submission #127386

# Submission time Handle Problem Language Result Execution time Memory
127386 2019-07-09T10:07:18 Z impri Studentsko (COCI14_studentsko) C++14
0 / 100
50 ms 536 KB
#include<bits/stdc++.h>
using namespace std;
int memo[10000];
int get(int arr[],int len,int cur){
if(memo[cur])
    return memo[cur];
int result=1;
if(len-1==cur)
    return 1;
for(int i=cur+1;i<len;i++){
    if(arr[i]>arr[cur])
    result=max(result,1+get(arr,len,i));

}
return memo[cur]=result;

}
int main(void){ios_base::sync_with_stdio(false);cin.tie(0);
 int n,k;
 vector<pair<int,int> >skills;
 int newarr[5000];

 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;
 }
 int result=0;
  for(int i=0;i<n;i++){
    result=max(result,get(newarr,n,i));
 }
 cout << n-result;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 504 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 536 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 528 KB Output isn't correct
2 Halted 0 ms 0 KB -