**[Error] invalid types 'long long unsigned int[int]' for array subscript**

C++编译器编译出现
[Error] invalid types 'long long unsigned int[int]' for array subscript

代码是这样的

#include
using namespace std;
const int N=100009;
int main() {
    unsigned long long  n, m, a, b, c, d, s[N][N], f[N][N];
    freopen("reward0.in", "r", stdin);
    freopen("reward0.out", "w", stdout);
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++) 
            cin >> f[i][j];
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            s[i][j] = f[i][j] + s[i][j - 1];
    int ans = INT_MIN;
    cin >> m;
    for (int k = 1; k <= m; k++) {
        cin >> a >> b >> c >> d;
        int cnt = 0;
        for (int i = a; i <= c; i++)
            cnt += s[i][d] - s[i][b - 1];
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

可能是你的 s 数组和 f 数组空间开得太大了。

const int N=100009;

试试给 N 去掉几个 0 再调试一遍。
也有可能是

cnt += s[i][d] - s[i][b - 1];

这里变量 cnt 和 数组 s 之间定义的类型不同(不过这里问题不是很大)

参考这个试试:https://blog.csdn.net/cool99781/article/details/119580433

数组太大了

把 你的数组定义,放到main 外面试试看

数组太大了,栈上放不下。扩大栈的大小,不过最好是定义到堆上,就是用new来分配