Submission #108180

#TimeUsernameProblemLanguageResultExecution timeMemory
108180aer0parkXCorr (KOI18_XCorr)C++14
0 / 100
4 ms512 KiB
#include <bits/stdc++.h> #define f first #define s second using namespace std; typedef long long ll; typedef pair<ll,ll> pi; ll n,m,mx,mn,anw; vector<pi> py,x; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin>>n; py.push_back({-1e10,0}); for(int i=0;i<n;i++) { ll a,b;cin>>a>>b; x.push_back({a,b}); } cin>>m; for(int i=0;i<m;i++) { ll a,b;cin>>a>>b; py.push_back({a,py[i].s+b}); } cin>>mn>>mx; for(int i=0;i<m;i++) { ll nw=x[i].f,nv=x[i].s,a=1,b=0; if(nw+mx<0) continue; b=upper_bound(py.begin(),py.end(),pi(nw+mx,1e11))-py.begin(); if(nw+mn>=0) a=lower_bound(py.begin(),py.end(),pi(nw+mn,-1e11))-py.begin(); anw+=nv*(py[b-1].s-py[a-1].s); } cout<<anw; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...