Submission #433503

#TimeUsernameProblemLanguageResultExecution timeMemory
433503joshualiu555A Huge Tower (CEOI10_tower)C++14
100 / 100
135 ms8080 KiB
#include <fstream> #include <iostream> #include <iomanip> #include <algorithm> #include <numeric> #include <vector> #include <set> #include <map> #include <cmath> #include <cstring> #include <climits> using namespace std; using ll = long long; const int INF = 2e5 + 5; const int MOD = 1e9 + 9; int main() { ios_base::sync_with_stdio(false); cin.tie(0); //ifstream fin(".in"); //ofstream fout(".out"); int n, d; cin >> n >> d; int x[n]; for (int i = 0; i < n; i++) cin >> x[i]; sort(x, x + n); ll ans = 1; int j = 0; for (int i = 0; i < n; i++) { while (x[j + 1] - x[i] <= d && j < n - 1) j++; int distance = j - i + 1; ans = (1ll * ans * distance) % MOD; } cout << ans; return 0; } //
#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...