# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
865564 | nase7faraj | A Huge Tower (CEOI10_tower) | C++14 | 98 ms | 8884 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pll pair<long long , long long>
#define pii pair<int , int>
#define mii map <int , int>
#define mll map <long long , long long>
#define vi vector <int>
#define vl vector <long long>
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rev greater<int>()
#define RF(F) freopen(F , "r" , stdin )
#define WF(F) freopen(F , "w" , stdout)
using namespace std ;
const ll INF = 1e9 ;
const int eps = 1e-7 ;
const int mod = 1e9 + 9 ;
const int MAX_N = 1e6 + 7 ;
int a[MAX_N] ;
void solve(int testCase){
int n , k ;
scanf("%d %d" , &n , &k) ;
for(int i = 0 ; i < n ; i ++){
scanf("%d" , &a[i]) ;
}
sort(a , a + n) ;
int l = 0 , r = 0 ;
ll ans = 1 ;
while(l < n){
while (r < n - 1 && (a[r + 1] - a[l]) <= k)r ++ ;
ans = ans * (r - l + 1) ;
ans %= mod ;
l ++ ;
}
printf("%lld\n" , ans) ;
}
int main() {
int testCase = 1 ;
for(int T = 1 ; T <= testCase ; T ++){
solve(T) ;
}
return 0 ;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |