Submission #480390

#TimeUsernameProblemLanguageResultExecution timeMemory
480390nehasaneA Huge Tower (CEOI10_tower)C++14
5 / 100
302 ms6668 KiB
#include <bits/stdc++.h> using namespace std; long long factorial(int s){ long long ans = 1; for (int i = s; i >= 1; i--) ans *= i; return ans; } int main() { int n, d; cin >> n >> d; vector <int> blocks(n); for (int i = 0; i < n; i++) cin >> blocks[i]; sort(begin(blocks), end(blocks)); long long ans = 1; int l = 0, r = 0; while (r < n){ if (blocks[l] + d >= blocks[r]){ r++; continue; }else{ ans *= factorial(r-l); l = r; continue; } } cout << ans * factorial(r-l) << '\n'; }
#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...