Submission #88786

#TimeUsernameProblemLanguageResultExecution timeMemory
88786asifthegreatStudentsko (COCI14_studentsko)C++14
10 / 100
60 ms972 KiB
#include <bits/stdc++.h> using namespace std; const int N = 50003; int ara[N],tmp[N],dp[N]; vector<int>v; int n,k; map<int,int>id; int main() { scanf("%d %d",&n,&k); for(int i = 0; i < n;i++){ scanf("%d",&ara[i]); tmp[i] = ara[i]; } sort(tmp,tmp+n); for(int i = 0; i < n;i++){ id[tmp[i]] = i/k; } for(int i = 0; i < n;i++){ v.push_back(id[ara[i]]); } //for(auto i: v){ // cout << i << " "; // }cout << endl; for(int i = 0; i <= n;i++)dp[i] = 1; for(int i = 1; i < n;i++){ for(int j = 0; j < i;j++){ if(v[j] <= v[i])dp[i] = max(dp[i],dp[j]+1); } } cout << n-dp[n-1] << endl; return 0; }

Compilation message (stderr)

studentsko.cpp: In function 'int main()':
studentsko.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&n,&k);
     ~~~~~^~~~~~~~~~~~~~~
studentsko.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&ara[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...