Submission #681106

# Submission time Handle Problem Language Result Execution time Memory
681106 2023-01-12T11:04:06 Z Cross_Ratio Nuclearia (CEOI15_nuclearia) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
int A[2500002][2];
int B[2500002][2];
array<long long int, 4> C[200005];
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int W, H;
    cin >> W >> H;
    A.resize(W);
    B.resize(W);
    int i, j;
    for(i=0;i<W;i++) {
        A[i].resize(H);
        B[i].resize(H);
    }
    int N;
    cin >> N;
    for(i=0;i<N;i++) {
        cin >> C[i][0] >> C[i][1] >> C[i][2] >> C[i][3];
        C[i][0]--, C[i][1]--;
        for(j=0;j<W;j++) {
            for(register int k = 0; k < H; k++) {
                A[j][k] += max(0LL, C[i][2] - max(abs(j-C[i][0]),abs(k-C[i][1])) * C[i][3]);
            }
        }
    }
    for(i=0;i<W;i++) {
        for(j=0;j<H;j++) {
            B[i][j] = (i?B[i-1][j]:0) + (j?B[i][j-1]:0) - ((long long int)i*j?B[i-1][j-1]:0) + A[i][j];
        }
    }
    int Q;
    cin >> Q;
    while(Q--) {
        long long int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--, b--, c--, d--;
        long long int val = B[c][d] - (a?B[a-1][d]:0) - (b?B[c][b-1]:0) + (a*b?B[a-1][b-1]:0);
        //cout << val << '\n

        long long int x = (c-a+1)* (d-b+1);
        long long int y = val / x;
        if(2*(val % x) >= x) y++;
        cout << y << '\n';
    }
}

Compilation message

nuclearia.cpp: In function 'int main()':
nuclearia.cpp:15:7: error: request for member 'resize' in 'A', which is of non-class type 'int [2500002][2]'
   15 |     A.resize(W);
      |       ^~~~~~
nuclearia.cpp:16:7: error: request for member 'resize' in 'B', which is of non-class type 'int [2500002][2]'
   16 |     B.resize(W);
      |       ^~~~~~
nuclearia.cpp:19:14: error: request for member 'resize' in 'A[i]', which is of non-class type 'int [2]'
   19 |         A[i].resize(H);
      |              ^~~~~~
nuclearia.cpp:20:14: error: request for member 'resize' in 'B[i]', which is of non-class type 'int [2]'
   20 |         B[i].resize(H);
      |              ^~~~~~
nuclearia.cpp:35:76: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
   35 |             B[i][j] = (i?B[i-1][j]:0) + (j?B[i][j-1]:0) - ((long long int)i*j?B[i-1][j-1]:0) + A[i][j];
      |                                                            ~~~~~~~~~~~~~~~~^~
nuclearia.cpp:44:77: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
   44 |         long long int val = B[c][d] - (a?B[a-1][d]:0) - (b?B[c][b-1]:0) + (a*b?B[a-1][b-1]:0);
      |                                                                            ~^~