Submission #63150

#TimeUsernameProblemLanguageResultExecution timeMemory
63150khsoo01XCorr (KOI18_XCorr)C++11
100 / 100
358 ms76776 KiB
#include<bits/stdc++.h> #define X first #define Y second using namespace std; typedef long long ll; typedef pair<ll, ll> pll; ll n, m, ans; vector<pll> a, b; int main() { scanf("%lld",&n); a.push_back({-1, 0}); for(int i=1;i<=n;i++) { int A, B; scanf("%d%d",&A,&B); a.push_back({A, B}); } sort(a.begin(), a.end()); for(int i=1;i<=n;i++) { a[i].Y += a[i-1].Y; } scanf("%lld",&m); for(int i=1;i<=m;i++) { int A, B; scanf("%d%d",&A,&B); b.push_back({A, B}); } ll S, E; scanf("%lld%lld",&E,&S); E *= -1; S *= -1; for(auto &T : b) { ll A, B; tie(A, B) = T; int i = lower_bound(a.begin(), a.end(), (pll){max(0ll, A+S), 0ll}) - a.begin() - 1; int j = lower_bound(a.begin(), a.end(), (pll){max(0ll, A+E+1), 0ll}) - a.begin() - 1; ans += (a[j].Y - a[i].Y) * B; } printf("%lld\n",ans); }

Compilation message (stderr)

XCorr.cpp: In function 'int main()':
XCorr.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
XCorr.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&A,&B);
   ~~~~~^~~~~~~~~~~~~~
XCorr.cpp:24:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&m);
  ~~~~~^~~~~~~~~~~
XCorr.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&A,&B);
   ~~~~~^~~~~~~~~~~~~~
XCorr.cpp:31:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld",&E,&S);
  ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...