# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
887082 | vjudge1 | Solar Storm (NOI20_solarstorm) | C++14 | 250 ms | 224436 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
const int N=1e6+10, LG=20;
int n, s, k, d[N], pos[N], v[N], nxt[N], nxt2[LG][N], pf[N];
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> s >> k;
for (int i=1; i<n; ++i) cin >> d[i], pos[i+1]=pos[i]+d[i];
for (int i=1; i<=n; ++i) cin >> v[i];
partial_sum(v, v+n+1, pf);
for (int i=1; i<=n; ++i){
nxt[i]=max(i, nxt[i-1]);
while (nxt[i]<n && pos[nxt[i]+1]-pos[i]<=k) ++nxt[i];
}
for (int i=1; i<=n; ++i) nxt2[0][i]=nxt[nxt[i]]+1;
for (int i=0; i<LG; ++i) nxt2[i][n+1]=n+1;
for (int lg=1; lg<LG; ++lg){
for (int i=n; i>=1; --i) nxt2[lg][i]=nxt2[lg-1][nxt2[lg-1][i]];
}
auto jump=[&](int x, int t) -> int {
t=min(t, n);
for (int i=0; i<LG; ++i) if (t>>i&1) x=nxt2[i][x];
return x;
};
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |