제출 #127121

#제출 시각아이디문제언어결과실행 시간메모리
127121arnold518XCorr (KOI18_XCorr)C++14
100 / 100
184 ms18524 KiB
#include <bits/stdc++.h>
using namespace std;

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

const int MAXN = 3e5;

int N, M;
ll A[MAXN+10], X[MAXN+10], B[MAXN+10], Y[MAXN+10], a, b, ans;

int main()
{
    int i, j;

    scanf("%d", &N);
    for(i=1; i<=N; i++) scanf("%lld%lld", &A[i], &X[i]);
    scanf("%d", &M); B[0]=-1e10; Y[0]=0;
    for(i=1; i<=M; i++) scanf("%lld%lld", &B[i], &Y[i]), Y[i]+=Y[i-1];
    scanf("%lld%lld", &a, &b);

    for(i=1; i<=N; i++)
    {
        ans+=X[i]*(Y[upper_bound(B, B+M+1, A[i]+b)-B-1]-Y[lower_bound(B, B+M+1, A[i]+a)-B-1]);
    }
    printf("%lld", ans);
}

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

XCorr.cpp: In function 'int main()':
XCorr.cpp:15:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;
            ^
XCorr.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
XCorr.cpp:18:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1; i<=N; i++) scanf("%lld%lld", &A[i], &X[i]);
                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &M); B[0]=-1e10; Y[0]=0;
     ~~~~~^~~~~~~~~~
XCorr.cpp:20:56: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1; i<=M; i++) scanf("%lld%lld", &B[i], &Y[i]), Y[i]+=Y[i-1];
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
XCorr.cpp:21:10: 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...