QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#87007#3002. Busy BoardKHINWA 60ms4944kbC++171.5kb2023-03-11 16:01:552023-03-11 16:11:30

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-11 16:11:30]
  • 评测
  • 测评结果:WA
  • 用时:60ms
  • 内存:4944kb
  • [2023-03-11 16:01:55]
  • 提交

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