# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56698 | andy0220 | 조개 줍기 (KOI17_shell) | C++11 | 752 ms | 167800 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;
typedef long long lld;
int N;
int A[1501][1501], D[1501][1501];
int bit[1501][1502];
int S[1501], E[1501];
void add(int n, int v, int bit[1502])
{ for (;n<=N;n+=n&(-n)) bit[n] += v; }
int get(int n, int bit[1502])
{ int ret = 0; for (;n;n^=n&(-n)) ret += bit[n]; return ret; }
inline int dp(int i, int j){ return D[i][j] + get(j, bit[i]); }
int main()
{
scanf("%d", &N);
for (int i=1;i<=N;i++) for (int j=1;j<=N;j++) scanf("%d", A[i]+j);
lld ans = 0;
for (int i=1;i<=N;i++) for (int j=1;j<=N;j++){
D[i][j] = max(D[i-1][j], D[i][j-1]) + A[i][j];
ans += D[i][j];
}
printf("%lld\n", ans);
for (int t=1;t<=N;t++){
char c; int y, x; scanf(" %c%d%d", &c, &y, &x);
int v = c == 'U' ? 1 : -1;
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... |