# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
835366 |
2023-08-23T13:51:33 Z |
12345678 |
Snowball (JOI21_ho_t2) |
C++17 |
|
516 ms |
2348 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=2e3+5;
ll n, q, l[nx], dp[nx], w, t, lw, hh;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>q;
for (int i=1; i<=n; i++) cin>>l[i];
l[0]=-1e18; l[n+1]=1e18;
while (q--)
{
cin>>w; t+=w;
if (t<lw)
{
for (int i=1; i<=n; i++) dp[i]+=min(max(0ll, (l[i]+lw)-(l[i-1]+hh)), lw-t);
}
if (t>hh)
{
for (int i=1; i<=n; i++) dp[i]+=min(max(0ll, (l[i+1]+lw)-(l[i]+hh)), t-hh);
}
lw=min(lw, t);
hh=max(hh, t);
//cout<<lw<<' '<<hh<<'\n';
//for (int i=1; i<=n; i++) cout<<dp[i]<<' ';
//cout<<'\n';
}
for (int i=1; i<=n; i++) cout<<dp[i]<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
7 ms |
376 KB |
Output is correct |
5 |
Correct |
7 ms |
340 KB |
Output is correct |
6 |
Correct |
6 ms |
388 KB |
Output is correct |
7 |
Correct |
6 ms |
340 KB |
Output is correct |
8 |
Correct |
8 ms |
388 KB |
Output is correct |
9 |
Correct |
4 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
7 ms |
340 KB |
Output is correct |
16 |
Correct |
7 ms |
332 KB |
Output is correct |
17 |
Correct |
6 ms |
332 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
7 ms |
376 KB |
Output is correct |
5 |
Correct |
7 ms |
340 KB |
Output is correct |
6 |
Correct |
6 ms |
388 KB |
Output is correct |
7 |
Correct |
6 ms |
340 KB |
Output is correct |
8 |
Correct |
8 ms |
388 KB |
Output is correct |
9 |
Correct |
4 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
7 ms |
340 KB |
Output is correct |
16 |
Correct |
7 ms |
332 KB |
Output is correct |
17 |
Correct |
6 ms |
332 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
332 KB |
Output is correct |
20 |
Correct |
19 ms |
2348 KB |
Output is correct |
21 |
Correct |
21 ms |
2228 KB |
Output is correct |
22 |
Correct |
59 ms |
1972 KB |
Output is correct |
23 |
Correct |
516 ms |
1860 KB |
Output is correct |
24 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 11 |
25 |
Halted |
0 ms |
0 KB |
- |