#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>>grille((n + 1), vector<int>(m)), grille3((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')
grille[i][j] = 1;
else
grille[i][j] = 0;
}
}
for (int i = 0; i < n; i++) {
cin >> a;
for (int j = 0; j <= m; j++) {
if (a[j] == '1')
grille3[i][j] = 1;
else
grille3[i][j] = 0;
}
}
vector<pair<pii, pii>>grille1(n*m);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
grille1[i * m + j].first.first = grille3[i][j];
grille1[i * m + j].first.second = grille3[i][j + 1];
grille1[i * m + j].second.second = grille[i][j];
grille1[i * m + j].second.first = grille[i + 1][j];
}
}
int res = -n * m;
for (int i = 0; i < n * m; i++) {
if (grille1[i].first.first == 1 and grille1[i].first.second == 1 and grille1[i].second.second == 1 and grille1[i].second.first == 1)
res++;
}
cout << res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
292 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 |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
292 KB |
Output isn't correct |
6 |
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 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
292 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 |
292 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |