| Task: | Forest density |
| Sender: | aalto26dm_030 |
| Submission time: | 2026-09-21 17:47:48 +0300 |
| Language: | C++ (C++23) |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.00 s | details |
| #2 | RUNTIME ERROR | 0.00 s | details |
| #3 | RUNTIME ERROR | 0.00 s | details |
Code
#include <iostream>
#include <vector>
int main(int argc, char** argv) {
int n, q;
std::cin >> n >> q;
std::vector<std::vector<long>> sum_until(n+1);
for (int i=0; i<n; i++) {
char c;
int sum = 0;
for (int j=0; j<n; j++) {
std::cin >> c;
sum_until.at(i).at(j+1) = sum + 1 ? (c=='.') : 0;
}
}
for (int i=0; i<q; i++) {
int a, b, c, d;
std::cin >> a >> b >> c >> d;
int result = sum_until.at(a).at(b) - sum_until.at(c).at(b) - sum_until.at(a).at(d) + sum_until.at(c).at(d);
std::cout << result << std::endl;
}
}Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 10 100 **.*.*.**. *.**.*..*. .*****.**. **....***. ... |
| correct output |
|---|
| 10 14 5 7 8 ... |
| user output |
|---|
| (empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 1) >= this->size() (which is 0)
Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 200000 **.**.****..**.***..**.***.**.... |
| correct output |
|---|
| 41079 2824 15631 1548 8483 ... |
| user output |
|---|
| (empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 1) >= this->size() (which is 0)
Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 200000 ******************************... |
| correct output |
|---|
| 1000000 1000000 1000000 1000000 1000000 ... |
| user output |
|---|
| (empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 1) >= this->size() (which is 0)
