Submission #553572

# Submission time Handle Problem Language Result Execution time Memory
553572 2022-04-26T09:31:14 Z 1BeeNY1 A Huge Tower (CEOI10_tower) C++17
90 / 100
56 ms 2324 KB
#include <bits/stdc++.h>

using namespace std;

int n,d,v[100005];
const int mod=1000000009;

int main()
{
    cin>>n>>d;
    for(int i=1; i<=n; i++) cin>>v[i];

    sort(v+1,v+n+1);
    int ways=1,pos=1;

    for(int i=2; i<=n; i++)
    {
        while(pos<i&&v[pos]+d<v[i]) pos++;
        ways=1LL*ways*(i-pos+1)%mod;
    }
    cout<<ways;

    return 0;
}
# 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 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 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 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 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 256 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 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 884 KB Output is correct
2 Correct 29 ms 960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 43 ms 2316 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 56 ms 2324 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -