QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#32865#884. Joining Treasure HuntAutumnKiteWA 0ms4536kbC++171.2kb2022-05-25 10:17:002022-05-25 10:17:02

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-25 10:17:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4536kb
  • [2022-05-25 10:17:00]
  • 提交

answer

#include <bits/stdc++.h>

const char name[] = "nsew";

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n, m;
  std::cin >> n >> m;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    char c;
    std::cin >> c;
    if (c == '?') {
      a[i] = -1;
    } else {
      int x;
      std::cin >> x;
      a[i] = (std::find(name, name + 4, c) - name) * 7 + x - 1;
    }
  }
  std::vector<int> b(m);
  for (int i = 0; i < m; ++i) {
    char c;
    std::cin >> c;
    if (c == '?') {
      b[i] = -1;
    } else {
      int x;
      std::cin >> x;
      b[i] = (std::find(name, name + 4, c) - name) * 4 + x - 1;
    }
  }

  const int C = 28;
  std::vector<std::bitset<400000>> mask(C);
  for (int i = 0; i < C; ++i) {
    mask[i].set();
  }
  for (int i = 0; i < m; ++i) {
    if (b[i] != -1) {
      mask[b[i]].reset(i);
    } else {
      for (int j = 0; j < C; ++j) {
        mask[j].reset(i);
      }
    }
  }
  std::bitset<400000> S;
  S.set();
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    S <<= 1;
    if (a[i] != -1) {
      S |= mask[a[i]];
    }
    if (!S.test(m - 1)) {
      ++ans;
    }
  }
  std::cout << ans << "\n";
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 4536kb

input:

4 3
n 4
e 1
?
s 5
?
e 1
?

output:

1

result:

wrong answer expected '2', found '1'