Submission #391454

#TimeUsernameProblemLanguageResultExecution timeMemory
391454whydoihavethisA Huge Tower (CEOI10_tower)C++11
30 / 100
301 ms8772 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n, d; cin >> n >> d; vector<int> arr(n); for(int i = 0; i < n; i++){ cin >> arr[i]; } sort(arr.begin(), arr.end()); int r = 0; int ctr = 1; for(int l = 0; l < n; l++){ while(r < n-1 && arr[r+1] - arr[l] <= d){ r++; } int maxdist = r-l+1; ctr = ctr*maxdist; } cout << ctr; }
#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...