0_0_31790725_19399.cpp:1:3191: fatal error: GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stdc++.h>usin: Invalid argument
#include <bits/stdc++.h>using namespace std;typedef long long ll; const int maxn = 1e6 + 10;const int maxm = 1e5 + 10;int t, n, m, p, cnt, ans[maxm];struct node { int l, r, sum; } tree[maxn << 2];struct cor { int x, y, type, qid; } cord[maxm << 2];struct qes { int x1, x2; } qest[maxm];// type == 0: square for update, type == 1: lower left square for query, type == 2: upper right square for query inline const int read(){ int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = (x << 3) + (x << 1) + ch - '0'; ch = getchar(); } return x * f;} int getVal(ll x, ll y){ x = x - n / 2 - 1; y = y - n / 2 - 1; ll tmp = max(abs(x), abs(y)); ll num = x >= y ? (ll)n * n - tmp * tmp * 4 - tmp * 2 - x - y : (ll)n * n - tmp * tmp * 4 + tmp * 2 + x + y; int res = 0; do { res += num % 10; num /= 10; } while (num); return res;} bool cmp(const cor &a, const cor &b){ if (a.y != b.y) return a.y < b.y; if (a.x != b.x) return a.x < b.x; if ((a.type == 0 && b.type == 1) || (a.type == 1 && b.type == 0)) return a.type > b.type; return a.type < b.type;} inline int ls(int id) {return id << 1;}inline int rs(int id) {return id << 1 | 1;} void push_up(int id){ tree[id].sum = tree[ls(id)].sum + tree[rs(id)].sum;} void build(int id, int l, int r){ tree[id].l = l; tree[id].r = r; tree[id].sum = 0; if (l == r) return; int mid = (l + r) >> 1; build(ls(id), l, mid); build(rs(id), mid + 1, r); push_up(id);} void update(int id, int l, int r, int v){ if (tree[id].l == l && tree[id].r == r) { tree[id].sum += (r - l + 1) * v; return; } int mid = (tree[id].l + tree[id].r) >> 1; if (r <= mid) update(ls(id), l, r, v); else if (l > mid) update(rs(id), l, r, v); else { update(ls(id), l, mid, v); update(rs(id), mid + 1, r, v); } push_up(id);} int query(int id, int l, int r){ if (tree[id].l == l && tree[id].r == r) return tree[id].sum; int mid = (tree[id].l + tree[id].r) >> 1; if (r <= mid) return query(ls(id), l, r); if (l > mid) return query(rs(id), l, r); return query(ls(id), l, mid) + query(rs(id), mid + 1, r);} int main(){ t = read(); while (t--) { cnt = 0; n = read(); m = read(); p = read(); build(1, 1, n); for (int i = 0; i < m; i++) { int x = read(), y = read(); cord[cnt++] = cor{x, y, 0, 0}; } for (int i = 0; i < p; i++) { int x1 = read(), y1 = read(), x2 = read(), y2 = read(); cord[cnt++] = cor{x1, y1, 1, i}; cord[cnt++] = cor{x2, y2, 2, i}; qest[i] = qes{x1, x2}; } sort(cord, cord + cnt, cmp); for (int i = 0; i < cnt; i++) { int x = cord[i].x, y = cord[i].y, id = cord[i].qid; if (cord[i].type == 0) update(1, x, x, getVal(x, y)); else if (cord[i].type == 1) ans[id] = query(1, qest[id].x1, qest[id].x2); else ans[id] = query(1, qest[id].x1, qest[id].x2) - ans[id]; } for (int i = 0; i < p; i++) printf("%d\n", ans[i]); } return 0;}
^
compilation terminated.
|