#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int, int> pii;
#define le first.first
#define ri first.second
#define dw second.first
#define up second.second
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>>hez((n + 1), vector<int>(m)), ver((n), vector<int>(m+1));
string a;
for (int i = 0; i <= n; i++) {
cin >> a;
for (int j = 0; j < m; j++) {
if (a[j] == '1')
hez[i][j] = 1;
else
hez[i][j] = 0;
}
}
for (int i = 0; i < n; i++) {
cin >> a;
for (int j = 0; j <= m; j++) {
if (a[j] == '1')
ver[i][j] = 1;
else
ver[i][j] = 0;
}
}
vector<pair<pii, pii>>vec(n*m);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
vec[i * m + j].le = ver[i][j];
vec[i * m + j].ri = ver[i][j + 1];
vec[i * m + j].up = hez[i][j];
vec[i * m + j].dw = hez[i + 1][j];
}
}
int ans = -n * m;
for (int i = 0; i < n * m; i++) {
if (vec[i].le == 1 and vec[i].ri == 1 and vec[i].up == 1 and vec[i].dw == 1)
ans++;
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
292 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
292 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |