Submission #486399

#TimeUsernameProblemLanguageResultExecution timeMemory
486399RainbowbunnyA Huge Tower (CEOI10_tower)C++17
100 / 100
112 ms8772 KiB
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 9; int Mul(int x, int y) { return 1ll * x * y % mod; } int n, d; vector <int> Arr; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> d; Arr.resize(n); for(auto &x : Arr) { cin >> x; } sort(Arr.begin(), Arr.end()); int pt = 0, ans = 1; for(int i = 0; i < Arr.size(); i++) { while(pt + 1 < (int)Arr.size() and Arr[pt + 1] <= Arr[i] + d) { pt++; } ans = Mul(ans, pt - i + 1); } cout << ans << '\n'; }

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:27:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int i = 0; i < Arr.size(); i++)
      |                    ~~^~~~~~~~~~~~
#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...