Submission #160757

#TimeUsernameProblemLanguageResultExecution timeMemory
160757luciocfA Huge Tower (CEOI10_tower)C++14
100 / 100
170 ms8988 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6+10; const int mod = 1e9+9; int a[maxn]; int main(void) { int n, d; scanf("%d %d", &n, &d); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); sort(a+1, a+n+1); int ans = 1, ptr = 1; for (int i = 1; i <= n; i++) { while (ptr < i && a[ptr]+d < a[i]) ptr++; ans = (1ll*ans*(i-ptr+1))%mod; } printf("%d\n", ans); }

Compilation message (stderr)

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