# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
125550 | 2019-07-05T22:34:44 Z | eriksuenderhauf | Nuclearia (CEOI15_nuclearia) | C++11 | 508 ms | 138248 KB |
//#pragma GCC optimize("O3") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define mem(a,v) memset((a), (v), sizeof (a)) #define enl printf("\n") #define case(t) printf("Case #%d: ", (t)) #define ni(n) scanf("%d", &(n)) #define nl(n) scanf("%I64d", &(n)) #define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i]) #define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i]) #define pri(n) printf("%d\n", (n)) #define prl(n) printf("%I64d\n", (n)) #define pii pair<int, int> #define pil pair<int, long long> #define pll pair<long long, long long> #define vii vector<pii> #define vil vector<pil> #define vll vector<pll> #define vi vector<int> #define vl vector<long long> #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef cc_hash_table<int,int,hash<int>> ht; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset; const double pi = acos(-1); const int MOD = 1e9 + 7; const int INF = 1e9 + 7; const int MAXN = 1e6 + 5; const double eps = 1e-9; vector<vl> off, sl, sm; int main() { int w, h, n; scanf("%d %d %d", &w, &h, &n); off.resize(h+1); sl.resize(h+1), sm.resize(h+1); for (int i = 0; i <= h; i++) off[i].resize(w+2), sl[i].resize(w+2), sm[i].resize(w+2); for (int i = 0; i < n; i++) { ll x, y, a, b; scanf("%lld %lld %lld %lld", &x, &y, &a, &b); ll l = max(1ll, x - a / b), r = min((ll)w, x + a / b); off[y][l] += a - (x - l) * b; off[y][r+1] -= a - (x-l) * b; sl[y][l+1] += b; sl[y][x+1] -= 2*b; sl[y][r+1] += b; //for (int j = max(1, y - a / b); j <= min(h, y + a / b); j++) {} } for (int i = 1; i <= h; i++) { for (int j = 1; j <= w; j++) { off[i][j] += off[i][j-1]; sl[i][j] += sl[i][j-1]; } for (int j = 1; j <= w; j++) { sl[i][j] += sl[i][j-1]; //cerr << i << " " << j << " " << off[i][j] << " " << sl[i][j] << "\n"; } for (int j = 1; j <= w; j++) sm[i][j] = sm[i-1][j] + sm[i][j-1] - sm[i-1][j-1] + sl[i][j] + off[i][j]; } int q; ni(q); while (q--) { ll x1, y1, x2, y2; scanf("%lld %lld %lld %lld", &x1, &y1, &x2, &y2); ll ans = sm[y2][x2] - sm[y1-1][x2] - sm[y2][x1-1] + sm[y1-1][x1-1]; x1 = (x2-x1+1) * (y2-y1+1); if ((ans % x1) * 2 >= x1) prl(ans / x1 + 1); else prl(ans / x1); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 118 ms | 117752 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 119 ms | 117920 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 73 ms | 59256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 128 ms | 79668 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 347 ms | 134544 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 272 ms | 63864 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 285 ms | 76408 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 261 ms | 52248 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 465 ms | 138168 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 508 ms | 138248 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 425 ms | 79596 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 428 ms | 79548 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 434 ms | 81808 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 409 ms | 79304 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |