## Submission #1084146

# Submission time Handle Problem Language Result Execution time Memory
1084146 2024-09-05T11:18:48 Z TraianDanciu A Huge Tower (CEOI10_tower) C++17
100 / 100
92 ms 8724 KB
```#include <stdio.h>
#include <algorithm>

#define MOD 1000000009
#define MAXN 1000000

int v[MAXN];

int main() {
int n, i, j, rez, d;

scanf("%d%d", &n, &d);
for(i = 0; i < n; i++) {
scanf("%d", &v[i]);
}

rez = 1;
std::sort(v, v + n);
j = 0;
for(i = 0; i < n; i++) {
while(j < n && v[i] + d >= v[j]) {
j++;
}
rez = 1LL * rez * (j - i) % MOD;
}

printf("%d\n", rez);
return 0;
}

```

### Compilation message

```tower.cpp: In function 'int main()':
tower.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
12 |   scanf("%d%d", &n, &d);
|   ~~~~~^~~~~~~~~~~~~~~~
tower.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
14 |     scanf("%d", &v[i]);
|     ~~~~~^~~~~~~~~~~~~```

#### Subtask #1 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #2 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 428 KB Output is correct

#### Subtask #3 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #4 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #5 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #6 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #7 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 360 KB Output is correct

#### Subtask #8 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #9 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct

#### Subtask #10 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #11 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct

#### Subtask #12 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #13 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #14 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #15 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct

#### Subtask #16 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct

#### Subtask #17 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct

#### Subtask #18 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 8 ms 860 KB Output is correct
2 Correct 8 ms 872 KB Output is correct

#### Subtask #19 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 38 ms 3764 KB Output is correct
2 Correct 36 ms 3676 KB Output is correct

#### Subtask #20 5.0 / 5.0

# Verdict Execution time Memory Grader output
1 Correct 83 ms 8724 KB Output is correct
2 Correct 92 ms 8268 KB Output is correct