# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88773 | 2018-12-08T15:42:46 Z | arman_ferdous | Studentsko (COCI14_studentsko) | C++17 | 6 ms | 1236 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 372 KB | Output is correct |
2 | Correct | 2 ms | 540 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 540 KB | Output is correct |
2 | Correct | 2 ms | 556 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 952 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 952 KB | Output is correct |
2 | Correct | 5 ms | 952 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 952 KB | Output is correct |
2 | Correct | 5 ms | 996 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1080 KB | Output is correct |
2 | Correct | 5 ms | 1080 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1172 KB | Output is correct |
2 | Correct | 5 ms | 1172 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1236 KB | Output is correct |
2 | Correct | 6 ms | 1236 KB | Output is correct |