Submission #225052

#TimeUsernameProblemLanguageResultExecution timeMemory
225052MKopchevA Huge Tower (CEOI10_tower)C++14
100 / 100
209 ms9956 KiB
#include<bits/stdc++.h> using namespace std; const int mod=1e9+9; int n,d; vector<int> inp; int main() { scanf("%i%i",&n,&d); for(int i=1;i<=n;i++) { int val; scanf("%i",&val); inp.push_back(val); } sort(inp.begin(),inp.end()); long long output=1; for(int i=0;i<n;i++) { int pos=lower_bound(inp.begin(),inp.end(),inp[i]-d)-inp.begin(); output=output*(i-pos+1)%mod; } printf("%lld\n",output); return 0; }

Compilation message (stderr)

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