Submission #895282

#TimeUsernameProblemLanguageResultExecution timeMemory
895282rainboyXCorr (KOI18_XCorr)C11
100 / 100
87 ms13648 KiB
#include <stdio.h> #define N 300000 #define M 300000 int main() { static int ii[N], xx[N], jj[M], yy[M]; int n, m, a, b, i, j, jl, jr, y; long long ans; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d%d", &ii[i], &xx[i]); scanf("%d", &m); for (j = 0; j < m; j++) scanf("%d%d", &jj[j], &yy[j]); scanf("%d%d", &a, &b); y = 0, ans = 0; for (i = 0, jl = 0, jr = 0; i < n; i++) { while (jr < m && jj[jr] <= ii[i] + b) y += yy[jr++]; while (jl < m && jj[jl] < ii[i] + a) y -= yy[jl++]; ans += (long long) xx[i] * y; } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

XCorr.c: In function 'main':
XCorr.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
XCorr.c:13:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d%d", &ii[i], &xx[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.c:14:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  scanf("%d", &m);
      |  ^~~~~~~~~~~~~~~
XCorr.c:16:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf("%d%d", &jj[j], &yy[j]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XCorr.c:17:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  scanf("%d%d", &a, &b);
      |  ^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...