Submission #480201

# Submission time Handle Problem Language Result Execution time Memory
480201 2021-10-15T09:39:55 Z mohamedsobhi777 A Huge Tower (CEOI10_tower) C++14
0 / 100
3 ms 392 KB
#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

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 time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 388 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 392 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -