Submission #88773

#TimeUsernameProblemLanguageResultExecution timeMemory
88773arman_ferdousStudentsko (COCI14_studentsko)C++17
100 / 100
6 ms1236 KiB
#include <bits/stdc++.h> using namespace std; int n, k; vector<int> arr, v; map<int,int> id; int lis() { vector<int> tmp; for(int i = 0; i < n; i++) { vector<int>::iterator it = upper_bound(tmp.begin(), tmp.end(), v[i]); if(it == tmp.end()) tmp.push_back(v[i]); else tmp[it - tmp.begin()] = v[i]; } return tmp.size(); } int main() { scanf("%d %d", &n, &k); for(int i = 0; i < n; i++) { int x; scanf("%d", &x); arr.push_back(x); } v = arr; sort(v.begin(), v.end()); for(int i = 0; i < n; i++) id[v[i]] = i/k; for(int i = 0; i < n; i++) v[i] = id[arr[i]]; // for(int x : v) cerr << x << " "; cerr << endl; // cerr << "lis = " << lis() << endl; int ans = n - lis(); printf("%d\n", ans); return 0; }

Compilation message (stderr)

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