Submission #129680

#TimeUsernameProblemLanguageResultExecution timeMemory
129680jhnah917조개 줍기 (KOI17_shell)C++14
12 / 100
2059 ms40384 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int n;
ll arr[1515][1515];
ll dp[1515][1515];

ll get(){
	ll ret = 0;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=n; j++){
			dp[i][j] = max(dp[i-1][j], dp[i][j-1]) + arr[i][j];
			ret += dp[i][j];
		}
	}
	return ret;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=n; j++){
			cin >> arr[i][j];
		}
	}
	
	cout << get() << "\n";
	for(int i=1; i<=n; i++){
		char op; int a, b;
		cin >> op >> a >> b;
		if(op == 'U') arr[a][b]++;
		else arr[a][b]--;
		cout << get() << "\n";
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...