답안 #118477

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118477 2019-06-19T04:57:56 Z str0ct XCorr (KOI18_XCorr) C++14
0 / 100
3 ms 512 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef struct{
    LL index;
    LL item;
}nd;
vector <nd> X,Y;
nd que[303030];
LL a,b;
int main(){
    nd imsi;
    scanf("%lld",&a);
    for(int i=0;i<a;i++){
        scanf("%lld %lld",&imsi.index,&imsi.item);
        X.push_back(imsi);
    }
    scanf("%lld",&a);
    for(int i=0;i<a;i++){
        scanf("%lld %lld",&imsi.index,&imsi.item);
        Y.push_back(imsi);
    }
    scanf("%lld %lld",&a,&b);
    LL sum=0,opt=0;
    LL j=0,fr=0,rear=-1;
    for(int i=0;i<X.size();i++){
        for(;j<Y.size()&&Y[j].index+a<=X[i].index;j++){
            que[++rear]=Y[j];
            sum+=Y[j].item;
        }
        while(rear>=fr&&que[fr].index+b<X[i].index)
            sum-=que[fr++].item;
        opt+=X[i].item*sum;
    }
    printf("%lld",opt);
}

Compilation message

XCorr.cpp: In function 'int main()':
XCorr.cpp:26:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<X.size();i++){
                 ~^~~~~~~~~
XCorr.cpp:27:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(;j<Y.size()&&Y[j].index+a<=X[i].index;j++){
              ~^~~~~~~~~
XCorr.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&a);
     ~~~~~^~~~~~~~~~~
XCorr.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld",&imsi.index,&imsi.item);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&a);
     ~~~~~^~~~~~~~~~~
XCorr.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld",&imsi.index,&imsi.item);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld",&a,&b);
     ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Incorrect 3 ms 512 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Incorrect 3 ms 512 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Incorrect 3 ms 512 KB Output isn't correct
3 Halted 0 ms 0 KB -