# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88777 | 2018-12-08T16:20:40 Z | tushar_2658 | Studentsko (COCI14_studentsko) | C++14 | 4 ms | 500 KB |
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define file freopen("in.txt", "r", stdin); #define pii pair<int,int> #define pb push_back #define all(v) v.begin(), v.end() #define keepunique(v) (v).erase(unique(all(v)),v.end()) #define fastread ios_base::sync_with_stdio(false);cin.tie(NULL); const int maxn = 5005; int n, k, cnt = 0; ll arr[maxn]; map<ll, ll>mark; vector<ll> vec, vec1; int dp[maxn]; ll t[maxn]; int CeilIndex(std::vector<ll>& v, int l, int r, int key) { while (r - l > 1) { int m = l + (r - l) / 2; if (v[m] >= key) r = m; else l = m; } return r; } int LongestIncreasingSubsequenceLength(std::vector<ll>& v) { if (v.size() == 0) return 0; std::vector<ll> tail(v.size(), 0); int length = 1; tail[0] = v[0]; for (size_t i = 1; i < v.size(); i++) { if (v[i] < tail[0]) tail[0] = v[i]; else if (v[i] >= tail[length - 1]) tail[length++] = v[i]; else tail[CeilIndex(tail, -1, length - 1, v[i])] = v[i]; } return length; } int solve(){ for(int i=0; i<n; i++)vec1.pb(mark[arr[i]]); int lon = 0; return n - LongestIncreasingSubsequenceLength(vec1); } int main(){ file //fastread scanf("%d%d", &n, &k); for(int i=0; i<n; i++){ scanf("%lld", &arr[i]); vec.pb(arr[i]); } //vec1 = vec; sort(all(vec)); for(int i=0; i<n; i++){ if(i%k == 0)++cnt; mark[vec[i]] = cnt; } printf("%d", solve()); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 372 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 448 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 448 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 476 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 476 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 476 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 476 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 500 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 500 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |