Submission #433501

#TimeUsernameProblemLanguageResultExecution timeMemory
433501joshualiu555A Huge Tower (CEOI10_tower)C++14
55 / 100
31 ms3564 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; ll n, d, x[INF]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); //ifstream fin(".in"); //ofstream fout(".out"); cin >> n >> d; for (ll i = 0; i < n; i++) cin >> x[i]; sort(x, x + n); ll ans = 1; ll j = 0; for (ll i = 0; i < n; i++) { while (x[j + 1] - x[i] <= d && j < n - 1) j++; ll distance = j - i + 1; ans *= 1ll * distance % MOD; } cout << ans % MOD; 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...