QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#355612#5101. Crystal CrosswindnvmdavaWA 1ms3824kbC++231.9kb2024-03-16 22:58:212024-03-16 22:58:22

Judging History

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

  • [2024-03-16 22:58:22]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3824kb
  • [2024-03-16 22:58:21]
  • 提交

answer

#if not LOCAL
#define NDEBUG 1
#endif
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(auto i = a; i < (b); ++i)
#define down(x, a) for (auto x = a; x--;)
#define all(x) begin(x), end(x)
#define sz(x) int(size(x))
#define let auto const

using ll = long long;
using lint = ll;
using pii = pair<int, int>;
using vi = vector<int>;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  int x, y, k;
  cin>>x>>y>>k;

  vector<vi> grid(x, vector<int>(y));
  vector<vi> must(x, vector<int>(y));
  vector<vi> can(x, vector<int>(y));

  auto bound = [&](int cx, int cy) {
    return cx < x && cx >= 0 && cy < y && cy >= 0;
  };

  vector<pair<int, int> > d;
  queue<pair<int, int> > q;
  rep(t, 0, k) {
    int dx, dy;
    cin>>dx>>dy;
    d.push_back({dx, dy});
    int b;
    cin>>b;
    while(b--) {
      int px, py;
      cin>>px>>py;
      --px; --py;
      grid[px][py] |= 1 << t;
      q.push({px, py});
      can[px][py]++;
      if(bound(px - dx, py - dy)) can[px - dx][py - dy] = -1;   
    }
  }

  rep(t, 0, k) {
    auto [dx, dy] = d[t];
    rep(i, 0, x) {
      rep(j, 0, y) {
        int px = i, py = j;
        while(bound(px + dx, py + dy)){
          px += dx; py += dy;
          if(grid[px][py] < 0) break;
          ++can[px][py];
        }
      }
    }
  }

  while(!q.empty()) {
    auto [px, py] = q.front();
    q.pop();
    if(must[px][py]) continue;
    must[px][py] = 1;
    int t = 0;
    for(auto& [dx, dy] : d) {
      if(((1 << t) & grid[px][py]) == 0) {
        if(must[px - dx][py - dy] == 0) {
          q.push({px - dx, py - dy});
        }
      }
      ++t;
    }
  }

  rep(j, 0, y) {
    rep(i, 0, x) {
      cout<<(must[i][j] ? '#' : '.');
    }
    cout<<'\n';
  }
  cout<<'\n';

  rep(j, 0, y) {
    rep(i, 0, x) {
      cout<< (can[i][j] >= k ? '#' : '.');
    }
    cout<<'\n';
  }
  cout<<'\n';
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3824kb

input:

4 1 1
0 1 2 1 1 3 1

output:

#.#.

#.#.


result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3784kb

input:

4 4 2
1 0 4 2 4 2 1 1 3 1 2
-1 0 4 4 3 4 2 3 1 3 4

output:

.##.
####
####
.##.

####
####
####
####


result:

wrong answer 6th lines differ - expected: '.##.', found: '####'