Submission #936019

#TimeUsernameProblemLanguageResultExecution timeMemory
936019srivatsav_kannanA Huge Tower (CEOI10_tower)C++14
100 / 100
116 ms10736 KiB
#include <iostream> #include <iomanip> #include <fstream> #include <vector> #include <set> #include <queue> #include <cmath> #include <map> #include <algorithm> #include <numeric> #include <stack> #include <cstring> #include <bitset> #include <climits> #include <valarray> #include <list> #include <unordered_map> #include <unordered_set> #include <complex> #define int long long int #define double long double #define endl '\n' #define mod 1000000009 #define inf 2000000000000000000 using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define ordered_set tree < pair<int,int> , nuint_type , less<pair<int,int>> , rb_tree_tag , tree_order_statistics_node_update> void solve(){ // ifstream fin("diamond.in"); // ofstream fout("diamond.out"); int n,d; cin >> n >> d; int ar[n]; for (int i = 0; i < n; i++) cin >> ar[i]; sort(ar, ar+n); int prev = 1; for (int i = 1; i < n; i++){ int l = 0, r = i; while (l < r){ int mid = (l+r)/2; if (ar[mid]+d >= ar[i]) r = mid; else l = mid+1; } int num = i-l; prev = ((prev%mod)*((num+1)%mod))%mod; } cout << prev << endl; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t = 1; //cin >> t; while (t--) { solve(); } 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...