QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#87007 | #3002. Busy Board | KHIN | WA | 60ms | 4944kb | C++17 | 1.5kb | 2023-03-11 16:01:55 | 2023-03-11 16:11:30 |
Judging History
answer
# include <cstdlib>
# include <vector>
# include <algorithm>
# include <iostream>
# include <ostream>
namespace khin {
using namespace std;
namespace main {
inline namespace source {}
namespace b { void main(); }
}
}
int main() { khin::main::b::main(); }
namespace khin::main::b {
void main() {
uint r, c; cin >> r >> c;
vector<vector<char>> s(r, vector<char>(c));
vector<vector<char>> t(r, vector<char>(c));
for (auto& x : s) for (char& ch : x) cin >> ch;
for (auto& x : t) for (char& ch : x) cin >> ch;
if (s == t) return cout << 1 << endl, void();
bool ok(false);
for (auto& x : s)
ok = ok || find(x.begin(), x.end(), 'O') != x.end();
if (!ok) return cout << 0 << endl, void();
vector<bool> era_r(r), era_c(c);
for (uint i(0); i < r; ++i)
if (count(t[i].begin(), t[i].end(), 'X') > 1)
for (uint j(0); j < c; ++j) if (t[i][j] == 'X')
era_c[j] = era_r[i] = true;
for (uint i(0); i < c; ++i) {
uint cnt(0);
for (uint j(0); j < r; ++j) cnt += t[j][i] == 'X';
if (cnt > 1) for (uint j(0); j < r; ++j)
if (t[j][i] == 'X') era_c[i] = era_r[j] = true;
}
for (uint i(0); i < r; ++i) if (era_r[i])
for (uint j(0); j < c; ++j)
if (s[i][j] == 'O' && t[i][j] == 'X')
return cout << 0 << endl, void();
for (uint i(0); i < c; ++i) if (era_c[i])
for (uint j(0); j < r; ++j)
if (s[j][i] == 'O' && t[j][i] == 'X')
return cout << 0 << endl, void();
cout << 1 << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 60ms
memory: 4944kb
input:
769 998 OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...
output:
1
result:
wrong answer expected 0, found 1