#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <unordered_set>
using namespace std;
#define ll long long
#define ff first
#define ss second
ll n, m, m1, m2, k;
ll MOD = 1e9 + 7;
ll INF = 1e18 + 7;
ll ttt;
ll cnt = 0;
vector<vector<pair<bool, bool>>>a(25, vector<pair<bool, bool>>(25));
int main()
{
cin >> n >> m;
for (int i = 0; i < n + 1; i++) {
for (int j = 0; j < m; j++) {
char x;
cin >> x;
a[i][j].ff = (x == '0' ? false : true);
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m + 1; j++) {
char x;
cin >> x;
a[i][j].ss = (x == '0' ? false : true);
}
}
ll ans = (n) * (m);
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= m; j++) {
//cout << a[i][j].ff << " " << a[i][j].ss << "\t";
if (a[i][j].ff && a[i][j].ss && a[i + 1][j].ff && a[i][j + 1].ss) {
ans--;
}
}
//cout << endl;
}
cout << -ans << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 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 |
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 |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
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 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 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 |
1 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 |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |