# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
855738 |
2023-10-01T17:29:17 Z |
vjudge1 |
Strah (COCI18_strah) |
C++17 |
|
1000 ms |
20048 KB |
//author: Ahmet Alp Orakci
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
char getcharr() {
char ch;
cin >> ch;
return ch;
}
#define ONLINE_JUDGE
void solve() {
int n, m;
cin >> n >> m;
vector <vector <int>> pref(n +1, vector <int> (m +1, 0));
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
if(getcharr() == '#') {
pref[i][j]++;
}
}
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
pref[i][j] += pref[i][j -1] + pref[i -1][j] - pref[i -1][j -1];
}
}
auto get = [&](int x1, int y1, int x2, int y2) -> int {
x1--;
y1--;
return pref[x2][y2] + pref[x1][y1] - pref[x2][y1] - pref[x1][y2];
};
i64 res = 0;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
for(int k = 1; k <= i; k++) {
for(int l = 1; l <= j; l++) {
for(int a = i; a <= n; a++) {
for(int b = j; b <= m; b++) {
if(get(k, l, a, b) == 0) {
//cerr << k << " " << l << " :: " << a << " " << b << " :: " << get(k, l, a, b) << "\n";
res++;
}
}
}
}
}
}
}
cout << res << "\n";
return;
}
signed main() {
#ifndef ONLINE_JUDGE
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int t = 1; //cin >> t;
for(int i = 1; i <= t; i++) {
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
460 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1080 ms |
720 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1034 ms |
860 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1031 ms |
856 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1055 ms |
5468 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1035 ms |
12368 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1014 ms |
8280 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1041 ms |
1624 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1004 ms |
20048 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |