Submission #154818

#TimeUsernameProblemLanguageResultExecution timeMemory
154818arnold518A Huge Tower (CEOI10_tower)C++14
100 / 100
187 ms8172 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1e6; const ll MOD = 1e9+9; int N, D; int A[MAXN+10]; ll ans=1; int main() { int i, j; scanf("%d%d", &N, &D); for(i=1; i<=N; i++) scanf("%d", &A[i]); sort(A+1, A+N+1); for(i=1; i<=N; i++) ans*=A+i-lower_bound(A+1, A+i, A[i]-D)+1, ans%=MOD; printf("%lld", ans); }

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:17:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;
            ^
tower.cpp:19: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:20:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1; i<=N; i++) 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...