QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#356573#5101. Crystal CrosswindTWTP_TCTFRE 0ms0kbC++142.3kb2024-03-18 01:24:482024-03-18 01:24:49

Judging History

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

  • [2024-03-18 01:24:49]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-03-18 01:24:48]
  • 提交

answer

#include<iostream>
#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 2e3 + 9, MOD = 998244353;
char a[N][N];
int dp[N][N];

// 1 -- must rock
// 2 -- must be empty
// 0

bool vis[11][N / 2][N / 2];
int dx[N], dy[N];
int n, m, k;
bool vis2[N][N];

void check(int x, int y) {
    if (vis2[x][y])return;
    vis2[x][y] = true;
    for (int i = 0; i < k; i++) {
        if (vis[i][x][y])continue;
        int nx = x - dx[i], ny = y - dy[i];
        if (max(nx, ny) > 0) {
            dp[nx][ny] = 1;
            check(nx, ny);
        }
    }
}

bool rockable(int x, int y) {
    if (dp[x][y])return true;
    dp[x][y] = 1;
    for (int i = 0; i < k; i++) {
        int nx = x - dx[i], ny = y - dy[i];
        if (max(nx, ny) <= 0 || nx > n || ny > m || !rockable(nx, ny)) {
            dp[x][y] = 0;
            return false;
        }
        nx = x + dx[i], ny = y + dy[i];
        if (max(nx, ny) > 0 && nx <= n && ny <= m && vis[i][nx][ny]) {
            dp[x][y] = 0;
            return false;
        }
    }
    return true;
}

void doWork() {
    cin >> m >> n >> k;

    for (int i = 0; i < k; i++) {
        int q;
        cin >> dy[i] >> dx[i] >> q;
        for (int j = 0; j < q; j++) {
            int x, y;
            cin >> y >> x;
            vis[i][x][y] = true;
            dp[x][y] = 1;
            if (min(x - dx[i], y - dy[i]) > 0) {
                dp[x - dx[i]][y - dy[i]] = 2;
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (dp[i][j] == 1) {
                check(i, j);
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (dp[i][j] == 1)cout << '#';
            else cout << '.';
        }
        cout << "\n";
    }
    cout << "\n";
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (dp[i][j] == 1 || (dp[i][j] == 0 && rockable(i, j)))cout << '#';
            else cout << '.';
        }
        cout << "\n";
    }
}

int main() {

    IO
    int t = 1;
//    cin >> t;
    for (int i = 1; i <= t; i++) {
        //  cout << "Case #" << i << ": ";
        doWork();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

4 1 1
0 1 2 1 1 3 1

output:


result: