# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
250660 | 2020-07-18T15:37:46 Z | kingfran1907 | Studentsko (COCI14_studentsko) | C++14 | 44 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; typedef long long llint; const int maxn = 5010; const int inf = 0x3f3f3f3f; int n, k; int niz[maxn]; vector< int > v; int dp[maxn]; int main() { scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) scanf("%d", niz+i); for (int i = 0; i < n; i++) v.push_back(niz[i]); sort(v.begin(), v.end()); for (int i = 0; i < n; i++) niz[i] = lower_bound(v.begin(), v.end(), niz[i]) - v.begin(); for (int i = 0; i < n; i++) niz[i] /= k; int sol = 0; for (int i = 0; i < n; i++) { dp[i] = 0; for (int j = 0; j < i; j++) { if (niz[j] <= niz[i]) dp[i] = max(dp[i], dp[j]); } dp[i]++; sol = max(sol, dp[i]); } printf("%d", n - sol); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 384 KB | Output is correct |
2 | Correct | 34 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 384 KB | Output is correct |
2 | Correct | 44 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 384 KB | Output is correct |
2 | Correct | 26 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 384 KB | Output is correct |
2 | Correct | 41 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 384 KB | Output is correct |
2 | Correct | 43 ms | 512 KB | Output is correct |