Submission #1010187

# Submission time Handle Problem Language Result Execution time Memory
1010187 2024-06-28T12:52:12 Z Petrix A Huge Tower (CEOI10_tower) C++17
100 / 100
203 ms 12112 KB
#include <iostream>
#include <algorithm>
using namespace std;

#define MOD 1000000009

long long v[10000001];

int main()
{
    long long n,m,i,rasp,st;
    cin>>n>>m;
    for(i=1;i<=n;i++) cin>>v[i];
    sort(v+1,v+n+1);
    rasp=1;st=1;
    for(i=1;i<=n;i++){
        while(st<i && v[st]+m<v[i])
            st++;
        rasp=(rasp*(i-st+1))%MOD;
    }
    cout<<rasp;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 2648 KB Output is correct
2 Correct 22 ms 2992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 2648 KB Output is correct
2 Correct 71 ms 4908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 175 ms 6740 KB Output is correct
2 Correct 203 ms 12112 KB Output is correct