Submission #553575

# Submission time Handle Problem Language Result Execution time Memory
553575 2022-04-26T09:34:08 Z 1BeeNY1 A Huge Tower (CEOI10_tower) C++17
90 / 100
48 ms 1392 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=(long long)ways*(i-pos+1)%mod;
    }
    cout<<ways;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 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 0 ms 220 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 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 720 KB Output is correct
2 Correct 29 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 47 ms 1392 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 48 ms 1340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -