# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
201404 | 2020-02-10T11:51:18 Z | ArKCa | Studentsko (COCI14_studentsko) | C++17 | 54 ms | 888 KB |
#include<bits/stdc++.h> #define f1 first #define s2 second #define pb push_back #define pob pop_back #define int ll #define ll long long #define PII pair<int,int> #define N 5003 using namespace std; int n,k; int dizi[N],dizim[N],sa[N]; map<int,int>m; int32_t main(){ // freopen("a.gir","r",stdin); // freopen("a.cik","w",stdout); scanf("%lld %lld",&n,&k); for(int i=0;i<n;i++){ scanf("%lld",&dizi[i]); dizim[i]=dizi[i]; } sort(dizim,dizim+n); for(int i=0;i<n;i++){ m[dizim[i]]=i/k; } for(int i=0;i<n;i++)dizi[i]=m[dizi[i]]; int mx=0; for(int i=n-1;i>=0;i--){ sa[i]=1; for(int j=i+1;j<n;j++){ if(dizi[i]<=dizi[j]) sa[i]=max(sa[i],sa[j]+1); } mx=max(mx,sa[i]); } printf("%lld\n",n-mx ); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 888 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 632 KB | Output is correct |
2 | Correct | 42 ms | 760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 760 KB | Output is correct |
2 | Correct | 51 ms | 836 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 864 KB | Output is correct |
2 | Correct | 33 ms | 760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 764 KB | Output is correct |
2 | Correct | 53 ms | 760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 760 KB | Output is correct |
2 | Correct | 51 ms | 832 KB | Output is correct |