Task: | Forest density |
Sender: | bielaltes |
Submission time: | 2024-09-23 17:05:27 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <iostream> #include <vector> #include <algorithm> #include <limits.h> #include <map> #include <math.h> #include <cstdlib> using namespace std; const int MOD = 1e9 + 7; int main() { int n, q; cin >> n >> q; auto forest = vector<string >(n); for (int i = 0; i < n; ++i){ cin >> forest[i]; } for (int i = 0; i < q; ++i){ int sum = 0; int x1, x2, y1, y2; cin >> y1 >>x1 >>y2 >>x2; for (int x = x1; x <= x2; ++x){ for (int y = y1; y <= y2; ++y) if (forest[y-1][x-1] == '*') sum++; } cout << sum << endl; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
10 100 **.*.*.**. *.**.*..*. .*****.**. **....***. ... |
correct output |
---|
10 14 5 7 8 ... |
user output |
---|
10 14 5 7 8 ... Truncated |
Test 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 200000 **.**.****..**.***..**.***.**.... |
correct output |
---|
41079 2824 15631 1548 8483 ... |
user output |
---|
(empty) |
Test 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 200000 ******************************... |
correct output |
---|
1000000 1000000 1000000 1000000 1000000 ... |
user output |
---|
(empty) |