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
#define ar array
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define lb lower_bound
#define ub upper_bound
#define FOR(i, a, b) for(auto i = a; i < b; i++)
#define FORD(i, a, b) for(auto i = a - 1; i >= b; i--)
#define trav(x, v) for(auto x : v)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
// ---------------------------------------- Solution ---------------------------------------- //
const int N = 25;
int n, m, ans;
int a[N][N];
int b[N][N];
void solve() {
cin >> n >> m;
FOR(i, 0, n + 1) {
FOR(j, 0, m) {
cin >> a[i][j];
}
}
FOR(i, 0, n) {
FOR(j, 0, m + 1) {
cin >> b[i][j];
}
}
FOR(i, 0, n) {
FOR(j, 0, m) {
if (a[i][j] && a[i + 1][j] && b[i][j] && b[i][j + 1]) ans++;
}
}
cout << -(n * m - ans) << "\n";
}
int main() {
fastio;
int tests = 1;
// cin >> tests;
while (tests--) {
solve();
}
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... |