Submission #895281

# Submission time Handle Problem Language Result Execution time Memory
895281 2023-12-29T17:38:05 Z rainboy None (KOI18_XCorr) C
0 / 100
2 ms 2396 KB
#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 += xx[i] * y;
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message

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 time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Incorrect 1 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Incorrect 1 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Incorrect 1 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -