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