Submission #654077

#TimeUsernameProblemLanguageResultExecution timeMemory
654077atharvdA Huge Tower (CEOI10_tower)C++14
100 / 100
257 ms2696 KiB
#include<iostream> #include<algorithm> #define MOD 1000000009 typedef long long ll; using namespace std; int main(){ int n, d; cin >> n >> d; int arr[n]; for(int i = 0; i < n; i++){ cin >> arr[i]; } sort(arr, arr + n); int l = 0; int count = 0; ll ans = 1; for(int r = 0; r < n; r++){ for(;arr[r] - arr[l] > d; l++){ count--; } count++; ans *= count; ans %= MOD; } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...