# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
108179 |
2019-04-27T23:53:01 Z |
aer0park |
None (KOI18_XCorr) |
C++14 |
|
3 ms |
592 KB |
#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> px,y;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
px.push_back({-1e10,0});
for(int i=0;i<n;i++)
{
ll a,b;cin>>a>>b;
px.push_back({a,px[i].s+b});
}
cin>>m;
for(int i=0;i<m;i++)
{
ll a,b;cin>>a>>b;
y.push_back({a,b});
}
cin>>mn>>mx;
for(int i=0;i<m;i++)
{
ll nw=y[i].f,nv=y[i].s,a=1,b=0;
if(nw+mx<0)
continue;
b=upper_bound(px.begin(),px.end(),pi(nw+mx,1e11))-px.begin();
if(nw+mn>=0)
a=lower_bound(px.begin(),px.end(),pi(nw+mn,-1e11))-px.begin();
anw+=nv*(px[b-1].s-px[a-1].s);
}
cout<<anw;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
512 KB |
Output is correct |
2 |
Incorrect |
3 ms |
592 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
512 KB |
Output is correct |
2 |
Incorrect |
3 ms |
592 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
512 KB |
Output is correct |
2 |
Incorrect |
3 ms |
592 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |