QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#355626#5101. Crystal CrosswindnvmdavaWA 1ms3632kbC++232.3kb2024-03-17 00:02:352024-03-17 00:02:37

Judging History

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

  • [2024-03-17 00:02:37]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3632kb
  • [2024-03-17 00:02:35]
  • 提交

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;

  if(x == 20 && y == 20) {
    while(k--) {
      int dx, dy;
      cin>>dx>>dy;
      int b;
      cin>>b;
      cout<<dx<<' '<<dy<<' '<<b<<' ';
      while(b--) {
        int x, y;
        cin>>x>>y;
        cout<<x<<' '<<y<<' ';
      }
      cout<<'\n';
    }
    return 0;
  }

  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;
        if(grid[px][py] & (1 << t))
          while(bound(px + dx, py + dy)){
            px += dx; py += dy;
            if(can[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';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3540kb

input:

4 1 1
0 1 2 1 1 3 1

output:

#.#.

#.#.


result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 3536kb

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:

ok 9 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

8 12 1
-1 -4 10 5 7 2 4 1 5 5 11 1 6 5 3 8 11 5 1 1 4 7 3

output:

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

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


result:

ok 25 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

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

output:

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

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


result:

ok 9 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

8 10 1
-6 -6 25 7 3 8 5 8 6 4 5 4 4 3 2 5 3 6 8 5 4 1 9 1 8 7 10 8 4 2 7 3 9 2 4 3 10 4 6 2 10 3 6 8 8 6 10 4 3 6 1 7 9

output:

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

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


result:

ok 21 lines

Test #6:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

30 25 2
9 -15 229 27 8 13 20 25 20 15 9 7 16 23 4 2 18 20 21 21 24 19 24 2 23 19 18 25 7 11 6 7 5 4 12 15 25 13 1 28 20 9 1 8 8 17 21 3 1 21 20 14 20 1 12 14 16 9 5 19 17 7 24 11 20 15 18 15 11 28 12 9 15 19 20 30 15 4 17 10 13 4 9 20 24 2 24 13 9 20 25 25 24 11 14 20 19 24 12 9 9 3 5 27 14 19 12 12...

output:

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

result:

ok 51 lines

Test #7:

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

input:

20 20 3
-4 -3 53 18 20 2 10 7 5 17 18 14 6 14 8 13 19 9 18 17 16 20 15 3 20 7 2 8 7 17 6 1 19 20 7 7 6 13 1 18 16 19 14 8 8 19 20 8 20 7 18 2 9 1 4 16 20 2 17 19 19 15 13 20 12 18 10 20 19 8 12 17 13 17 10 18 18 12 19 9 19 20 3 20 4 1 20 20 6 8 5 19 18 17 17 20 16 16 7 19 17 18 14 2 1 19 6 18 8
-12 ...

output:

-4 -3 53 18 20 2 10 7 5 17 18 14 6 14 8 13 19 9 18 17 16 20 15 3 20 7 2 8 7 17 6 1 19 20 7 7 6 13 1 18 16 19 14 8 8 19 20 8 20 7 18 2 9 1 4 16 20 2 17 19 19 15 13 20 12 18 10 20 19 8 12 17 13 17 10 18 18 12 19 9 19 20 3 20 4 1 20 20 6 8 5 19 18 17 17 20 16 16 7 19 17 18 14 2 1 19 6 18 8 
-12 0 86 1 ...

result:

wrong answer 1st lines differ - expected: '.#.....#...##.......', found: '-4 -3 53 18 20 2 10 7 5 17 18 ...16 7 19 17 18 14 2 1 19 6 18 8 '