QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#86976#3002. Busy BoardKHINWA 65ms5352kbC++171.4kb2023-03-11 15:39:172023-03-11 15:39:19

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 15:39:19]
  • 评测
  • 测评结果:WA
  • 用时:65ms
  • 内存:5352kb
  • [2023-03-11 15:39:17]
  • 提交

answer

# include <cstdlib>
# include <vector>
# include <algorithm>
# include <iostream>

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 (r == c) 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])
      if (s[i] != t[i]) 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] != t[j][i])
        return cout << 0 << endl, void();
    cout << 1 << endl;
  }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 63ms
memory: 4872kb

input:

769 998
OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #2:

score: 0
Accepted
time: 62ms
memory: 5352kb

input:

977 998
OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #3:

score: -100
Wrong Answer
time: 65ms
memory: 5228kb

input:

941 973
XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

0

result:

wrong answer expected 1, found 0