Submission #85094

#TimeUsernameProblemLanguageResultExecution timeMemory
85094tjdgus4384XCorr (KOI18_XCorr)C++14
100 / 100
346 ms228868 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; pair<ll, ll> a[300001], b[300001]; ll n, m, ans, x, y; int main() { ll i, j, l; scanf("%lld", &n); for(int i = 1;i <= n;i++) { scanf("%lld %lld", &a[i].first, &a[i].second); } scanf("%lld", &m); for(int i = 1;i <= m;i++) { scanf("%lld %lld", &b[i].first, &b[i].second); b[i].second += b[i - 1].second; } scanf("%lld %lld", &x, &y); for(int i = 1, j = 1, k = 1;i <= n;i++) { for(;j <= m && a[i].first + x > b[j].first;j++); for(;k <= m && a[i].first + y >= b[k].first;k++); ans += a[i].second * (b[k - 1].second - b[j - 1].second); } printf("%lld", ans); return 0; }

Compilation message (stderr)

XCorr.cpp: In function 'int main()':
XCorr.cpp:9:8: warning: unused variable 'i' [-Wunused-variable]
     ll i, j, l;
        ^
XCorr.cpp:9:11: warning: unused variable 'j' [-Wunused-variable]
     ll i, j, l;
           ^
XCorr.cpp:9:14: warning: unused variable 'l' [-Wunused-variable]
     ll i, j, l;
              ^
XCorr.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &n);
     ~~~~~^~~~~~~~~~~~
XCorr.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &a[i].first, &a[i].second);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &m);
     ~~~~~^~~~~~~~~~~~
XCorr.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &b[i].first, &b[i].second);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld", &x, &y);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...