Submission #201404

#TimeUsernameProblemLanguageResultExecution timeMemory
201404ArKCaStudentsko (COCI14_studentsko)C++17
100 / 100
54 ms888 KiB
#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 (stderr)

studentsko.cpp: In function 'int32_t main()':
studentsko.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld",&n,&k);
  ~~~~~^~~~~~~~~~~~~~~~~~~
studentsko.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&dizi[i]);
   ~~~~~^~~~~~~~~~~~~~~~~
#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...