Submission #1005712

# Submission time Handle Problem Language Result Execution time Memory
1005712 2024-06-22T21:36:07 Z tgp07 A Huge Tower (CEOI10_tower) C++17
100 / 100
166 ms 11092 KB
#include<iostream>
#include<algorithm>
using namespace std;
 
typedef long long ll;
 
const ll MOD=1e9 + 9;
int main(){
  ll n,d;
  cin>>n>>d;
  
  ll block[n];
  for(ll i=0;i<n;i++){
    cin>>block[i];
  }
  
  sort(block,block+n);
  
  ll ans=1;
  ll j=0;
  for(ll i=0;i<n;i++){
    while(j<i && block[j]+d<block[i]){
      j++;
    }
    ans=((ans*(i-j+1))%MOD)%MOD;
  }
  cout<<ans<<"\n";
}
# 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 344 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 344 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 344 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 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 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 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 1116 KB Output is correct
2 Correct 19 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 4656 KB Output is correct
2 Correct 75 ms 4692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 166 ms 11092 KB Output is correct
2 Correct 166 ms 10580 KB Output is correct