# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420592 | schse | Financial Report (JOI21_financial) | C++17 | 4075 ms | 3788 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define INF INT32_MAX
using namespace std;
int main()
{
vector<int> arr;
int N, D;
cin >> N >> D;
vector<int> biggest(N + 2, INF);
vector<int> lastindex(N + 2, -1);
arr.resize(N);
for (int &i : arr)
cin >> i;
for (int index = 0; index < N; index++)
{
int val = arr[index];
biggest[0] = -1;
lastindex[0] = index;
for (int i = 1; i < lastindex.size(); i++) // nicht mehr aktuelles löschen
{
if (lastindex[i] < index - D)
biggest[i] = INF;
}
for (int e = 0; e < biggest.size(); e++) // ablaufsdatum updaten
if (biggest[e] >= val)
lastindex[e] = index;
for (int i = 0; i < biggest.size() - 1; i++) //
{
if (biggest[i] < val && val < biggest[i + 1])
{
biggest[i + 1] = val;
lastindex[i + 1] = index;
}
}
}
int t = biggest.size() - 1;
while (biggest[t] == INF)
t--;
cout << t;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |