Submission #590501

# Submission time Handle Problem Language Result Execution time Memory
590501 2022-07-06T04:21:56 Z nodal_tree A Huge Tower (CEOI10_tower) C++17
10 / 100
281 ms 13620 KB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 10e9 + 9;
int main() {
  int N; int D; cin >> N >> D; int dp[N + 1]; int top[N + 1]; int a[N + 1];
  a[0] = 0; dp[0] = 1; top[0] = 0;
  for(int i = 1; i<=N; i++){
     cin >> a[i]; dp[i] = 1; top[i] = 0;
  }
  sort(a, a + N);
  int l = 1;
  for(int r = 1; r<=N; r++){
    while(a[r] - a[l] > D){
      l++;
    }
    top[r] = r - l;
  }
  for(int i = 1; i<=N; i++){
    dp[i] = (dp[i - 1] * (top[i] + 1)) % MOD;
  }
  cout << dp[N] << '\n';
  return 0;
}

Compilation message

tower.cpp:5:22: warning: overflow in conversion from 'double' to 'int' changes value from '1.0000000009e+10' to '2147483647' [-Woverflow]
    5 | const int MOD = 10e9 + 9;
      |                 ~~~~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 216 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 1372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 5632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 281 ms 13620 KB Output isn't correct
2 Halted 0 ms 0 KB -