Submission #1084457

# Submission time Handle Problem Language Result Execution time Memory
1084457 2024-09-06T09:20:31 Z 7again A Huge Tower (CEOI10_tower) C++17
100 / 100
197 ms 10580 KB
#include <bits/stdc++.h>
using namespace std ;
#define int long long
const int N = 100 ;

main(){
    int n , k ;
    cin >> n >> k ;

    vector<int> a(n + 1) ;
    for(int i = 0 ; i < n ; i++) {
        cin >> a[i] ;
        a[i] *= -1 ;
    }
    a[n] = 1e12 ;
    sort(a.begin(), a.end() ) ;

    int ans = 1 ;
    for(int i = 0 ; i < n ; i++) {
        int r = upper_bound(a.begin(), a.end(), a[i] + k) - a.begin() ;
        ans *= r - i ;
        ans %= (1000000009) ;
    }

    cout << ans ;
}

Compilation message

tower.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1112 KB Output is correct
2 Correct 16 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 4432 KB Output is correct
2 Correct 78 ms 4688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 186 ms 10064 KB Output is correct
2 Correct 197 ms 10580 KB Output is correct