Submission #785047

# Submission time Handle Problem Language Result Execution time Memory
785047 2023-07-17T01:54:39 Z Hanksburger A Huge Tower (CEOI10_tower) C++17
100 / 100
111 ms 11120 KB
#include <bits/stdc++.h>
using namespace std;
long long a[1000005], mod=1000000009;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n, d, ans=1;
    cin >> n >> d;
    for (long long i=0; i<n; i++)
        cin >> a[i];
    sort(a, a+n);
    for (long long i=0; i<n; i++)
        ans=(ans*(i-(lower_bound(a, a+i, a[i]-d)-a)+1))%mod;
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1216 KB Output is correct
2 Correct 10 ms 1176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 4708 KB Output is correct
2 Correct 40 ms 4688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 11120 KB Output is correct
2 Correct 111 ms 10616 KB Output is correct