# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
723376 | abouton | Measures (CEOI22_measures) | C++17 | 1533 ms | 316 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>
using namespace std;
#define int long long
int N, M, D;
vector<int> pos;
signed main()
{
scanf("%lld%lld%lld", &N, &M, &D);
for (int i = 0; i < N; i ++)
{
int a;
scanf("%lld", &a);
pos.push_back(a);
}
for (int x = 0; x < M; x ++)
{
int a; scanf("%lld", &a);
int cur = pos.size()-1;
pos.push_back(0);
while (cur >= 0 && pos[cur] > a)
{
pos[cur+1] = pos[cur];
cur --;
}
cur++;
pos[cur]=a;
int maxi = 0;
for (int i = 0; i < (int)pos.size(); i ++)
{
for (int j = i+1; j < (int)pos.size(); j ++)
{
maxi = max(maxi, (j-i)*D - (pos[j]-pos[i]));
}
}
if (maxi%2==1) cout << (maxi-1)/2 << ".5 ";
else cout << maxi/2 << ' ';
//for( int i = 0; i < pos.size(); i ++) printf("%d ", pos[i]);
//printf("\n");
}
}
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... |