Submission #570044

# Submission time Handle Problem Language Result Execution time Memory
570044 2022-05-28T13:37:46 Z 600Mihnea Nuclearia (CEOI15_nuclearia) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);

  /// freopen ("input.txt", "r", stdin);

  bool Inverse = 0;

  int n, m;
  cin >> n >> m;
  if (n > m) {
    Inverse = 1;
    swap(n, m);
  }
  assert(n <= m);
  vector<vector<ll>> radiation(n + 1, vector<ll> (m + 1, 0));

  int ops;
  cin >> ops;
  for (int i = 1; i <= ops; i++) {
    int r1, c1, a, b;
    cin >> r1 >> c1 >> a >> b;
    if (inverse) {
      swap(r1, c1);
    }
    for (int r = 1; r <= n; r++) {
      for (int c = 1; c <= m; c++) {
        int dist = max(abs(r - r1), abs(c - c1));
        radiation[r][c] += max(0LL, a - 1LL * b * dist);
      }
    }
  }

  {
    /// transform the radiation in the form of prefix rectangle sum

    for (int i = 1; i <= n; i++) {
      ll cur = 0;
      for (int j = 1; j <= m; j++) {
        cur += radiation[i][j];
        radiation[i][j] = radiation[i - 1][j] + cur;
      }
    }
  }

  int q;
  cin >> q;
  while (q--) {
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    if (inverse) {
      swap(r1, c1);
      swap(r2, c2);
    }
    ll total = radiation[r2][c2] - radiation[r1 - 1][c2] - radiation[r2][c1 - 1] + radiation[r1 - 1][c1 - 1];
    ll area = (r2 - r1 + 1) * (c2 - c1 + 1);

    cout << total / area + (total % area >= area - total % area) << "\n";
  }
}

Compilation message

nuclearia.cpp: In function 'int main()':
nuclearia.cpp:28:9: error: 'inverse' was not declared in this scope; did you mean 'Inverse'?
   28 |     if (inverse) {
      |         ^~~~~~~
      |         Inverse
nuclearia.cpp:56:9: error: 'inverse' was not declared in this scope; did you mean 'Inverse'?
   56 |     if (inverse) {
      |         ^~~~~~~
      |         Inverse