Submission #1082512

# Submission time Handle Problem Language Result Execution time Memory
1082512 2024-08-31T14:15:10 Z hahahaha A Huge Tower (CEOI10_tower) C++17
100 / 100
96 ms 9552 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 1 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 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 344 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 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 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 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1116 KB Output is correct
2 Correct 7 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 41 ms 3664 KB Output is correct
2 Correct 44 ms 3768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 9552 KB Output is correct
2 Correct 96 ms 8972 KB Output is correct