제출 #65656

#제출 시각아이디문제언어결과실행 시간메모리
65656sebinkimXCorr (KOI18_XCorr)C++14
100 / 100
199 ms235504 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

pll A[303030], B[303030];
ll n, m, ans, a, b;

int main()
{
	ll i, j, l;
	
	scanf("%lld", &n);
	
	for(i=1; i<=n; i++){
		scanf("%lld%lld", &A[i].first, &A[i].second);
	}
	
	scanf("%lld", &m);
	
	for(i=1; i<=m; i++){
		scanf("%lld%lld", &B[i].first, &B[i].second);
		B[i].second += B[i-1].second;
	}
	
	scanf("%lld%lld", &a, &b);
	
	for(i=j=l=1; i<=n; i++){
		for(; j <= m && A[i].first + a > B[j].first; j++);
		for(; l <= m && A[i].first + b >= B[l].first; l++);
		ans += A[i].second * (B[l-1].second - B[j-1].second);
	}
	
	printf("%lld\n", ans);
	
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

XCorr.cpp: In function 'int main()':
XCorr.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &n);
  ~~~~~^~~~~~~~~~~~
XCorr.cpp:18:8: 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:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &m);
  ~~~~~^~~~~~~~~~~~
XCorr.cpp:24:8: 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:28:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld", &a, &b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...