Submission #1084146

#TimeUsernameProblemLanguageResultExecution timeMemory
1084146TraianDanciuA Huge Tower (CEOI10_tower)C++17
100 / 100
92 ms8724 KiB
#include <stdio.h> #include <algorithm> #define MOD 1000000009 #define MAXN 1000000 int v[MAXN]; int main() { int n, i, j, rez, d; scanf("%d%d", &n, &d); for(i = 0; i < n; i++) { scanf("%d", &v[i]); } rez = 1; std::sort(v, v + n); j = 0; for(i = 0; i < n; i++) { while(j < n && v[i] + d >= v[j]) { j++; } rez = 1LL * rez * (j - i) % MOD; } printf("%d\n", rez); return 0; }

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%d%d", &n, &d);
      |   ~~~~~^~~~~~~~~~~~~~~~
tower.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d", &v[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...