Submission #890728

#TimeUsernameProblemLanguageResultExecution timeMemory
890728eric_geA Huge Tower (CEOI10_tower)C++17
100 / 100
110 ms11344 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; #define F0R(i, a, b) for (int i = (a); i < (b); i++) #define FOR(i, a) F0R(i, 0, a) #define f first #define s second int cx[] = {0, 1, 0, -1}; int cy[] = {1, 0, -1, 0}; const ll INF = 1e9 + 9; bool cpr(ll a, ll b) { return {a > b}; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll n, diff; cin >> n >> diff; vector<ll> nums(n); FOR(i, n) cin >> nums[i]; sort(nums.begin(), nums.end(), cpr); ll ans = 1; ll r = 0; ll l = 0; while(r != n && l != n) { while (nums[l] + diff >= nums[r] && l != n) { ans *= (l - r + 1); ans = ans % INF; l++; } r++; } 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...