建议加强数据,O(mn^2)的暴力AC了

P3397 地毯

asd890123 @ 2024-06-24 18:43:18

rt,暴力AC了,code:

#include <iostream>

#define maxn 1005

int n,m,a[maxn][maxn];

int main(){

    std::cin.tie(0)->sync_with_stdio(0);

    std::cin >> n >> m;
    for (int i = 1;i <= m;i++){

        int x1,y1,x2,y2;

        std::cin >> x1 >> y1 >> x2 >> y2;
        for (int j = x1;j <= x2;j++)
            for (int k = y1;k <= y2;k++)
                a[j][k]++;

    }
    for (int i = 1;i <= n;i++){

        for (int j = 1;j <= n;j++)
            std::cout << a[i][j] << ' ';
        std::cout << '\n';

    }

    return 0;
}

不要说1e9能过很正常,如果正是这样加大数据范围/改标签,记录


by shensiyuan2011 @ 2024-07-03 16:09:37

@asd890123 你开了O2


by shensiyuan2011 @ 2024-07-03 16:11:34

@asd890123 还有,洛谷测评机最大测评是O(10^9),你的代码是O(mn的平方),理论上极限数据是能过的


|