# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
462273 | kingfran1907 | Nuclearia (CEOI15_nuclearia) | C++14 | 1099 ms | 303548 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long llint;
const int maxn = 3e6+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 18;
const int off = 1 << logo;
const int treesiz = off << 1;
int n, q;
int w, h;
vector< llint > niz[maxn];
vector< llint > pref[maxn];
int main() {
scanf("%d%d", &w, &h);
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
niz[i].push_back(0);
scanf("%d", &n);
while (n--) {
int x, y;
llint a, b;
scanf("%d%d%lld%lld", &x, &y, &a, &b); x--, y--;
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
int dis = max(abs(i - x), abs(j - y));
llint kol = max(0LL, a - b * dis);
niz[i][j] += kol;
}
}
}
for (int i = 0; i <= w; i++) {
for (int j = 0; j <= h; j++) {
pref[i].push_back(0);
}
}
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
pref[i + 1][j + 1] = niz[i][j];
pref[i + 1][j + 1] += pref[i + 1][j];
}
}
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
pref[i + 1][j + 1] += pref[i][j + 1];
}
}
scanf("%d", &q);
while (q--) {
int x1, y1, x2, y2;
scanf("%d%d%d%d", &x1, &y1, &x2, &y2); x1--, y1--;
llint sum = pref[x2][y2] - pref[x1][y2] - pref[x2][y1] + pref[x1][y1];
llint cnt = (llint)(x2 - x1) * (y2 - y1);
llint sol = sum / cnt;
llint rem = sum % cnt;
if (rem * 2 >= cnt) printf("%lld\n", sol + 1);
else printf("%lld\n", sol);
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |