# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
163355 | 2019-11-12T19:30:05 Z | beso123 | Studentsko (COCI14_studentsko) | C++14 | 70 ms | 712 KB |
#include<bits/stdc++.h> #define int long long using namespace std; int n,s,a[5001],dp[5001]; pair<int,int> m[5001]; main(){ cin>>n>>s; for(int k=1;k<=n;k++){ int b; cin>>b; m[k]={b,k}; } sort(m+1,m+n+1); int t=1; int h=1; for(int k=1;k<=n;k++){ if(t>s){ t=1; h++; } a[m[k].second]=h; t++; } dp[1]=1; int len=1; for(int k=2;k<=n;k++){ dp[k]=1; for(int i=1;i<k;i++){ if(a[i]<=a[k]) dp[k]=max(dp[k],dp[i]+1); } len=max(len,dp[k]); } cout<<n-len; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 1 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 508 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 552 KB | Output is correct |
2 | Correct | 43 ms | 632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 47 ms | 508 KB | Output is correct |
2 | Correct | 53 ms | 632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 488 KB | Output is correct |
2 | Correct | 33 ms | 636 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 632 KB | Output is correct |
2 | Correct | 50 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 504 KB | Output is correct |
2 | Correct | 70 ms | 712 KB | Output is correct |