답안 #85093

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
85093 2018-11-18T13:27:10 Z tjdgus4384 XCorr (KOI18_XCorr) C++14
19 / 100
1000 ms 10108 KB
#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 j, k, i = 1;i <= n;i++)
    {
        for(j = 1;j <= m && a[i].first + x > b[j].first;j++);
        for(k = 1;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

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);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 10 ms 508 KB Output is correct
3 Correct 19 ms 712 KB Output is correct
4 Correct 7 ms 816 KB Output is correct
5 Correct 2 ms 816 KB Output is correct
6 Correct 15 ms 816 KB Output is correct
7 Correct 3 ms 864 KB Output is correct
8 Correct 6 ms 936 KB Output is correct
9 Correct 3 ms 936 KB Output is correct
10 Correct 15 ms 1056 KB Output is correct
11 Correct 2 ms 1112 KB Output is correct
12 Correct 11 ms 1132 KB Output is correct
13 Correct 23 ms 1188 KB Output is correct
14 Correct 2 ms 1188 KB Output is correct
15 Correct 2 ms 1188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 10 ms 508 KB Output is correct
3 Correct 19 ms 712 KB Output is correct
4 Correct 7 ms 816 KB Output is correct
5 Correct 2 ms 816 KB Output is correct
6 Correct 15 ms 816 KB Output is correct
7 Correct 3 ms 864 KB Output is correct
8 Correct 6 ms 936 KB Output is correct
9 Correct 3 ms 936 KB Output is correct
10 Correct 15 ms 1056 KB Output is correct
11 Correct 2 ms 1112 KB Output is correct
12 Correct 11 ms 1132 KB Output is correct
13 Correct 23 ms 1188 KB Output is correct
14 Correct 2 ms 1188 KB Output is correct
15 Correct 2 ms 1188 KB Output is correct
16 Execution timed out 1078 ms 10108 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 10 ms 508 KB Output is correct
3 Correct 19 ms 712 KB Output is correct
4 Correct 7 ms 816 KB Output is correct
5 Correct 2 ms 816 KB Output is correct
6 Correct 15 ms 816 KB Output is correct
7 Correct 3 ms 864 KB Output is correct
8 Correct 6 ms 936 KB Output is correct
9 Correct 3 ms 936 KB Output is correct
10 Correct 15 ms 1056 KB Output is correct
11 Correct 2 ms 1112 KB Output is correct
12 Correct 11 ms 1132 KB Output is correct
13 Correct 23 ms 1188 KB Output is correct
14 Correct 2 ms 1188 KB Output is correct
15 Correct 2 ms 1188 KB Output is correct
16 Execution timed out 1078 ms 10108 KB Time limit exceeded
17 Halted 0 ms 0 KB -