Submission #1082512

#TimeUsernameProblemLanguageResultExecution timeMemory
1082512hahahahaA Huge Tower (CEOI10_tower)C++17
100 / 100
96 ms9552 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...