Submission #850876

#TimeUsernameProblemLanguageResultExecution timeMemory
850876tvladm2009A Huge Tower (CEOI10_tower)C++17
0 / 100
1 ms548 KiB
#include <bits/stdc++.h> using namespace std; bool home = 1; typedef long long ll; const int M = (int) 1e9 + 9; int n; int d; int mul(int a, int b) { return a * (ll)b % M; } int main() { if (!home) { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } else { freopen ("input", "r", stdin); } cin >> n >> d; vector<int> v; for (int i = 1; i <= n; i++) { int x; cin >> x; v.push_back(x); } sort(v.begin(), v.end()); int j = (int) v.size() - 1; int ret = 1; for (int i = (int) v.size() - 2; i >= 0; i--) { while (v[i] + d < v[j]) { j--; } ret = mul(ret, j - i + 1); } cout << ret << "\n"; return 0; }

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:21:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     freopen ("input", "r", stdin);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...