QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519965#1819. Cleaning RobotEdwardH101WA 0ms3624kbC++171.1kb2024-08-15 09:54:312024-08-15 09:54:32

Judging History

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

  • [2024-08-15 09:54:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2024-08-15 09:54:31]
  • 提交

answer

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

using namespace std;

int largestRobotSize(int n, int m, vector<vector<int>>& obstructions) {
    vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
    vector<vector<bool>> is_obstructed(n + 1, vector<bool>(m + 1, false));

    for (const auto& obs : obstructions) {
        int i = obs[0], j = obs[1];
        is_obstructed[i][j] = true;
    }

    int maxSize = 0;

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            if (!is_obstructed[i][j]) {
                dp[i][j] = min({dp[i-1][j], dp[i][j-1], dp[i-1][j-1]}) + 1;
                maxSize = max(maxSize, dp[i][j]);
            }
        }
    }

    return (maxSize > 0) ? maxSize : -1;
}

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    
    vector<vector<int>> obstructions(k, vector<int>(2));
    for (int i = 0; i < k; ++i) {
        cin >> obstructions[i][0] >> obstructions[i][1];
    }

    int result = largestRobotSize(n, m, obstructions);
    cout << result << endl;
    
    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

10 7 1
8 3

output:

7

result:

wrong answer expected '2', found '7'