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 <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;
}
# | 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... |