답안 #849128

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
849128 2023-09-14T06:43:00 Z luanmenglei 로봇 골프 (ROI19_golf) C++17
0 / 100
19 ms 8412 KB
#include <bits/stdc++.h>
using namespace std;

void debug(const char *msg, ...) {
#ifdef CLESIP
    va_list arg;
    static char pbString[512];
    va_start(arg, msg);
    vsprintf(pbString, msg, arg);
    cerr << "[DEBUG] " << pbString << "\n";
    va_end(arg);
#endif
}

using i64 = long long;
const int N = 1010;
const i64 P = 998244353;
bool v[N][N];
int a[N][N], n, m, k, f[N][N][2];

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> m >> k;
	for (int i = 1, x, y; i <= k; i ++) {
		cin >> x >> y;
		cin >> a[x][y];
		v[x][y] = true;
	}
	for (int i = n; i >= 1; i --) {
		for (int j = m; j >= 1; j --) {
			if (v[i][j]) {
				f[i][j][0] = f[i][j][1] = a[i][j];
			} else {
				f[i][j][0] = min(f[i + 1][j][1], f[i][j + 1][1]);
				f[i][j][1] = max(f[i + 1][j][0], f[i][j + 1][0]);
			}
		}
	}
	i64 ans = 0;
	for (int i = 1; i <= n; i ++) {
		for (int j = 1; j <= m; j ++) {
			debug("f[%d][%d] = %d", i, j, f[i][j][0]);
			ans = (ans + f[i][j][0] + P) % P;
		}
	}
	cout << ans;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4812 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Incorrect 1 ms 4444 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Incorrect 4 ms 4952 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 8412 KB Output is correct
2 Runtime error 3 ms 4696 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4812 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Incorrect 1 ms 4444 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 4696 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 4696 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4812 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Incorrect 1 ms 4444 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 4696 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4812 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Incorrect 1 ms 4444 KB Output isn't correct
7 Halted 0 ms 0 KB -