Submission #136747

#TimeUsernameProblemLanguageResultExecution timeMemory
136747choikiwonA Huge Tower (CEOI10_tower)C++17
100 / 100
175 ms10616 KiB
#include<bits/stdc++.h> using namespace std; const int mod = 1e9 + 9; int N, D; vector<int> A, B; int main() { scanf("%d %d", &N, &D); A.resize(N); for(int i = 0; i < N; i++) { scanf("%d", &A[i]); } sort(A.begin(), A.end()); B.resize(N); int pos = 0; for(int i = 0; i < N; i++) { while(pos < i && A[pos] + D < A[i]) pos++; B[i] = i - pos; } int ans = 1; for(int i = 1; i < N; i++) { ans = 1LL * ans * (B[i] + 1) % mod; } printf("%d", ans); }

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("%d %d", &N, &D);
     ~~~~~^~~~~~~~~~~~~~~~~
tower.cpp:14:14: 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...