Submission #596666

# Submission time Handle Problem Language Result Execution time Memory
596666 2022-07-15T00:26:26 Z Merakulus A Huge Tower (CEOI10_tower) C++17
30 / 100
262 ms 2716 KB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int mod = 1e9 + 9;

int main(){
    int n = 0;
    int d = 0;
    int ans = 1;

    cin >> n >> d;

    vector<int> size(n);

    for(int i = 0; i < n; i++){
        cin >> size[i];
    }

    sort(size.begin(), size.end());

    int r = 0;

    for(int i = 0; i < n; i++){
        while(r < n && size[r] - size[i] <= d){
            r += 1;
        }

        int tSize = r - i;

        ans *= tSize;

        ans % mod;
    }

    cout << ans << endl;

    return 0;
}

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:34:13: warning: statement has no effect [-Wunused-value]
   34 |         ans % mod;
      |         ~~~~^~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 212 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 0 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 Correct 0 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 212 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 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 Incorrect 5 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 110 ms 1264 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 262 ms 2716 KB Output isn't correct
2 Halted 0 ms 0 KB -