This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
#define x first
#define y second
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
int main() {
int n, m;
cin >> n >> m;
vvb hor_edge(n + 1, vb(m)), ver_edge(n, vb(m + 1));
for (int i = 0; i <= n; i++) {
for (int j = 0; j < m; j++) {
char c;
cin >> c;
hor_edge[i][j] = c == '1';
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j <= m; j++) {
char c;
cin >> c;
ver_edge[i][j] = c == '1';
}
}
int ans = n * m;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (hor_edge[i][j] && hor_edge[i + 1][j] && ver_edge[i][j] && ver_edge[i][j + 1]) {
ans--;
}
}
}
cout << -ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |