Submission #464705

#TimeUsernameProblemLanguageResultExecution timeMemory
464705jackkkkA Huge Tower (CEOI10_tower)C++11
100 / 100
141 ms10564 KiB
/* Problem title: A Huge Tower Problem link: https://oj.uz/problem/view/CEOI10_tower */ #include <stdio.h> #include <iostream> #include <string> #include <vector> #include <queue> #include <map> #include <array> #include <deque> #include <unordered_map> #include <unordered_set> #include <set> #include <algorithm> #include <stdlib.h> #include <math.h> #include <list> #include <float.h> #include <climits> #include <cmath> using namespace std; #define _USE_MATH_DEFINES #define F first #define S second #define MP make_pair typedef long long LL; typedef pair<long long, long long> pii; typedef pair<LL, LL> pll; void quit(){ cout.flush(); exit(0); } LL NM=1e9+9; LL n, d; vector <LL> nums; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> d; nums.resize(n); for(LL i = 0; i < n; i++){ cin >> nums[i]; } sort(nums.begin(), nums.end()); LL r = 1; LL ans = 1; for(LL l = 0; l < n; l++){ while(r<n && nums[r]-nums[l]<=d){ ans *= r-l+1; ans %= NM; r++; } } cout << ans << "\n"; quit(); }
#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...