Submission #691741

#TimeUsernameProblemLanguageResultExecution timeMemory
691741vjudge1A Huge Tower (CEOI10_tower)C++17
30 / 100
107 ms11232 KiB
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <cmath> #include <algorithm> using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define f first #define s second #define lb lower_bound #define ub upper_bound using vi = vector<int>; using ll = long long; using pii = pair<int, int>; using pdd = pair<double, double>; const int maxn = 1e6 + 7; int n; ll num[maxn]; ll mod = 1e9 + 7, d; int main() { ios::sync_with_stdio(false); cin >> n >> d; rep(i, 0, n) cin >> num[i]; sort(num, num + n); ll res = 1; rep(i, 0, n) { ll x = num[i] - d; int cnt = i - (lower_bound(num, num + i, x) - num); res = (res * (cnt + 1LL)) % mod; } cout << res << endl; }
#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...