이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |