Submission #857429

#TimeUsernameProblemLanguageResultExecution timeMemory
857429CMJA Huge Tower (CEOI10_tower)C11
100 / 100
122 ms8916 KiB
#include <stdio.h> #include <stdlib.h> int int_cmp(const void *a, const void *b) { return (*((int *)a)) - (*((int *)b)); } 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 (stderr)

tower.c: In function 'main':
tower.c:32:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   32 |  printf("%d\n", sol);
      |          ~^     ~~~
      |           |     |
      |           int   long long int
      |          %lld
tower.c:16:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  scanf("%d %d\n", &n, &d);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
tower.c:20:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   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...