Submission #725307

# Submission time Handle Problem Language Result Execution time Memory
725307 2023-04-17T08:19:27 Z groshi A Huge Tower (CEOI10_tower) C++17
100 / 100
130 ms 13512 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int mod=1e9+9;
int32_t main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int n,m,x;
    cin>>n>>m;
    vector<int> Q;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        Q.push_back(x);
    }
    sort(Q.begin(),Q.end());
    int wynik=1;
    int r=Q.size()-1;
    for(int i=Q.size()-1;i>=0;i--)
    {
        while(r>=1 && Q[i]-Q[r-1]<=m)
            r--;
        wynik*=(i-r+1);
        wynik%=mod;
    }
    cout<<wynik;
    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 0 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 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 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 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 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 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 984 KB Output is correct
2 Correct 12 ms 1392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 2492 KB Output is correct
2 Correct 46 ms 4728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 97 ms 8592 KB Output is correct
2 Correct 130 ms 13512 KB Output is correct