Submission #857431

# Submission time Handle Problem Language Result Execution time Memory
857431 2023-10-06T07:54:17 Z CMJ A Huge Tower (CEOI10_tower) C++
100 / 100
94 ms 3448 KB
#include <algorithm>
#include <stdio.h>

int b[1000000];

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);
	}

	std::sort(b, b + n);

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

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:25:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   25 |  printf("%d\n", sol);
      |          ~^     ~~~
      |           |     |
      |           int   long long int
      |          %lld
tower.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d %d\n", &n, &d);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
tower.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d", b + i);
      |   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 604 KB Output is correct
2 Correct 7 ms 520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1372 KB Output is correct
2 Correct 36 ms 1380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 3448 KB Output is correct
2 Correct 94 ms 3416 KB Output is correct