Submission #219866

#TimeUsernameProblemLanguageResultExecution timeMemory
219866mhy908A Huge Tower (CEOI10_tower)C++14
0 / 100
143 ms8828 KiB
#include <bits/stdc++.h> using namespace std; typedef long long LL; const LL MOD=1000000009; int n, d, arr[1000010]; LL ans=1; int main(){ scanf("%d %d", &n, &d); for(int i=1; i<=n; i++)scanf("%d", &arr[i]); sort(arr+1, arr+n+1); for(int i=1; i<=n; i++){ ans*=i+(lower_bound(arr+1, arr+n+1, arr[i]-d)-arr)+1; ans%=MOD; } printf("%lld", ans); }

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:8: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:9:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=n; i++)scanf("%d", &arr[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...