Submission #163354

#TimeUsernameProblemLanguageResultExecution timeMemory
163354beso123Studentsko (COCI14_studentsko)C++14
30 / 100
4 ms632 KiB
#include<bits/stdc++.h> #define int long long using namespace std; int n,s,a[1001],dp[1001]; pair<int,int> m[1001]; 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 (stderr)

studentsko.cpp:6:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#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...