Submission #480203

# Submission time Handle Problem Language Result Execution time Memory
480203 2021-10-15T09:40:42 Z mohamedsobhi777 A Huge Tower (CEOI10_tower) C++14
90 / 100
31 ms 4188 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 7;
const int mod = 1e9 + 9 ; 
int n, d ; 
int a[N] ; 

int main()
{
       ios_base::sync_with_stdio(0);
       cin.tie(0);
#ifndef ONLINE_JUDGE
#endif
       cin >> n >> d ; 
       for(int i = 1 ;i <= n; ++ i){
              cin >> a[i] ; 
       }
       sort(a + 1, a + n + 1) ; 
       int j = 1; 
       int ans = 1 ; 
       for(int i = 1 ;i <= n;++ i){
              while(a[i]-a[j]>d) ++ j; 
              int len = i - j + 1; 
              ans = 1ll * ans * len % mod ; 
       }
       cout << ans ; 
       return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 988 KB Output is correct
2 Correct 11 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 4188 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 4172 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -