Submission #68127

#TimeUsernameProblemLanguageResultExecution timeMemory
68127red1108XCorr (KOI18_XCorr)C++17
100 / 100
315 ms238132 KiB
#include <iostream>
#include <algorithm>
using namespace std;
int an, bn;
long long ax[300010],a[300010],bx[300010],b[300010],bsum[300010],ans,l,r;
int main()
{
    int i;
    scanf("%d",&an);
    for(i=1;i<=an;i++)
    {
        scanf("%lld %lld", &ax[i], &a[i]);
    }
    scanf("%d",&bn);
    for(i=1;i<=bn;i++)
    {
        scanf("%lld %lld", &bx[i], &b[i]);
        bsum[i]=bsum[i-1]+b[i];
    }
    scanf("%lld %lld", &l, &r);
    for(i=1;i<=an;i++)
    {
        ans=ans+(bsum[upper_bound(bx+1,bx+bn+1,ax[i]+r)-bx-1]-bsum[lower_bound(bx+1,bx+bn+1,ax[i]+l)-bx-1])*a[i];
    }
    printf("%lld", ans);
}

Compilation message (stderr)

XCorr.cpp: In function 'int main()':
XCorr.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&an);
     ~~~~~^~~~~~~~~~
XCorr.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &ax[i], &a[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&bn);
     ~~~~~^~~~~~~~~~
XCorr.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &bx[i], &b[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld", &l, &r);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...