# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404415 | joelau | 조개 줍기 (KOI17_shell) | C++14 | 724 ms | 35396 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int N, A[1500][1500];
long long ft[1500][1501];
void update (int n, int x, long long v) {
x++;
while (x <= N) ft[n][x] += v, x += x & -x;
}
void update (int n, int a, int b, long long v) {
update(n,a,v); update(n,b+1,-v);
}
long long query (int n, int x) {
x++;
long long ans = 0;
while (x) ans += ft[n][x], x -= x & -x;
return ans;
}
long long f(int x, int y) {
long long ans = 0;
if (x != 0) ans = max(ans,query(x-1,y));
if (y != 0) ans = max(ans,query(x,y-1));
return ans + A[x][y];
}
int main() {
Compilation message (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... |