Submission #480201

#TimeUsernameProblemLanguageResultExecution timeMemory
480201mohamedsobhi777A Huge Tower (CEOI10_tower)C++14
0 / 100
3 ms392 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; const int mod = 1e9 + 9 ; int n, d ; int a[N] ; int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); #endif cin >> n >> d ; for(int i = 1 ;i <= n; ++ i){ cin >> a[i] ; } sort(a + 1, a + n + 1) ; int j = 1; int ans = 1 ; for(int i = 1 ;i <= n;++ i){ while(a[i]-a[j]>d) ++ j; int len = i - j + 1; ans = 1ll * ans * len % mod ; } cout << ans ; return 0; }

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:15:15: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |        freopen("in.in", "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...