Submission #113140

#TimeUsernameProblemLanguageResultExecution timeMemory
113140luciocfStudentsko (COCI14_studentsko)C++14
100 / 100
5 ms736 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 5e3+10; int n; int a[maxn], aux[maxn]; int lis(void) { vector<int> v; for (int i = 1; i <= n; i++) { vector<int>::iterator it = upper_bound(v.begin(), v.end(), a[i]); if (it == v.end()) v.push_back(a[i]); else *it = a[i]; } return v.size(); } int main(void) { int k; scanf("%d %d", &n, &k); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); aux[i] = a[i]; } sort(aux+1, aux+n+1); map<int, int> group; for (int i = 1; i <= n; i++) group[aux[i]] = (i-1)/k; for (int i = 1; i <= n; i++) a[i] = group[a[i]]; printf("%d\n", n-lis()); }

Compilation message (stderr)

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