# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
911433 | vjudge1 | Snowball (JOI21_ho_t2) | C++11 | 824 ms | 13724 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;
typedef long long ll;
signed main() {
ll n, q;
cin>>n>>q;
vector<ll>pos(n);
for(ll i=0;i<n;i++){
cin>>pos[i];
}
vector<pair<ll,ll>>rangos;
rangos.push_back({0,0});
ll ml=0,rr=0;
ll suma=0;
for(ll i=0;i<q;i++){
ll w;
cin>>w;
suma+=w;
rr=max(suma,rr);
ml=min(suma,ml);
rangos.push_back({ml,rr});
}
vector<ll>amplitud(n,0LL);
amplitud[0]=-rangos[rangos.size()-1].first;
amplitud[n-1]+=rangos[rangos.size()-1].second;
for(ll i=0LL;i<n-1;i++){
ll l=0,r=rangos.size();
while(l<r){
ll mid=(l+r)/2;
if(pos[i]+rangos[mid].second>pos[i+1]+rangos[mid].first){
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |