Submission #857428

# Submission time Handle Problem Language Result Execution time Memory
857428 2023-10-06T07:50:56 Z CMJ A Huge Tower (CEOI10_tower) C
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <stdlib.h>

int b[1000000];

#define MOD 1000000009

int main()
{
	int n, d;
	scanf("%d %d\n", &n, &d);
	long long int sol = 1;

	for(int i = 0; i < n; i++) {
		scanf("%d", b + i);
	}

	qsort(b, n, sizeof(int), int_cmp);

	int l = 0, r = 0;
	while(l < n) {
		while((r < n) && (b[r] <= b[l] + d))
			r++;
		sol = (sol * (r - l)) % MOD;
		l++;
	}
	printf("%d\n", sol);
}

Compilation message

tower.c: In function 'main':
tower.c:18:27: error: 'int_cmp' undeclared (first use in this function)
   18 |  qsort(b, n, sizeof(int), int_cmp);
      |                           ^~~~~~~
tower.c:18:27: note: each undeclared identifier is reported only once for each function it appears in
tower.c:27:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   27 |  printf("%d\n", sol);
      |          ~^     ~~~
      |           |     |
      |           int   long long int
      |          %lld
tower.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d %d\n", &n, &d);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
tower.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", b + i);
      |   ^~~~~~~~~~~~~~~~~~