Submission #292722

# Submission time Handle Problem Language Result Execution time Memory
292722 2020-09-07T12:19:09 Z 임성재(#5807) Robogolf (ROI19_golf) C++17
20 / 100
59 ms 17272 KB
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define em emplace 
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 1e9;
const ll INF = 1e18;
const ll Mod = 998244353;

int n, m, k;
ll dp[1010][1010];
ll Dp[1010][1010];
bool chk[1010][1010];

int main() {
	fast;

	cin >> n >> m >> k;

	for(int i=1; i<=k; i++) {
		int x, y, w;
		cin >> x >> y >> w;

		dp[x][y] = Dp[x][y] = w;
		chk[x][y] = true;
	}

	ll ans = 0;

	for(int i=n; i>=1; i--) {
		for(int j=m; j>=1; j--) {
			if(chk[i][j]) continue;

			dp[i][j] = min(Dp[i+1][j], Dp[i][j+1]);
			Dp[i][j] = max(dp[i+1][j], dp[i][j+1]);
		}
	}

	for(int i=1; i<=n; i++) {
		for(int j=1; j<=m; j++) {
			ans += Mod + dp[i][j] % Mod;
			ans %= Mod;
		}
	}

	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 20 ms 16128 KB Output is correct
10 Correct 56 ms 17152 KB Output is correct
11 Correct 56 ms 17152 KB Output is correct
12 Correct 58 ms 17152 KB Output is correct
13 Correct 55 ms 17152 KB Output is correct
14 Correct 46 ms 8704 KB Output is correct
15 Correct 53 ms 17144 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 6 ms 9344 KB Output is correct
18 Correct 2 ms 512 KB Output is correct
19 Correct 7 ms 9472 KB Output is correct
20 Correct 1 ms 512 KB Output is correct
21 Correct 6 ms 9472 KB Output is correct
22 Correct 55 ms 17152 KB Output is correct
23 Correct 55 ms 17144 KB Output is correct
24 Correct 56 ms 17272 KB Output is correct
25 Correct 59 ms 17152 KB Output is correct
26 Correct 56 ms 17196 KB Output is correct
27 Correct 55 ms 17152 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 6 ms 8960 KB Output is correct
32 Correct 37 ms 11520 KB Output is correct
33 Correct 41 ms 15352 KB Output is correct
34 Correct 28 ms 8192 KB Output is correct
35 Correct 28 ms 7672 KB Output is correct
36 Correct 30 ms 7168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 6 ms 640 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 2048 KB Output is correct
2 Runtime error 2 ms 512 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 20 ms 16128 KB Output is correct
10 Correct 56 ms 17152 KB Output is correct
11 Correct 56 ms 17152 KB Output is correct
12 Correct 58 ms 17152 KB Output is correct
13 Correct 55 ms 17152 KB Output is correct
14 Correct 46 ms 8704 KB Output is correct
15 Correct 53 ms 17144 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 6 ms 9344 KB Output is correct
18 Correct 2 ms 512 KB Output is correct
19 Correct 7 ms 9472 KB Output is correct
20 Correct 1 ms 512 KB Output is correct
21 Correct 6 ms 9472 KB Output is correct
22 Correct 55 ms 17152 KB Output is correct
23 Correct 55 ms 17144 KB Output is correct
24 Correct 56 ms 17272 KB Output is correct
25 Correct 59 ms 17152 KB Output is correct
26 Correct 56 ms 17196 KB Output is correct
27 Correct 55 ms 17152 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 6 ms 8960 KB Output is correct
32 Correct 37 ms 11520 KB Output is correct
33 Correct 41 ms 15352 KB Output is correct
34 Correct 28 ms 8192 KB Output is correct
35 Correct 28 ms 7672 KB Output is correct
36 Correct 30 ms 7168 KB Output is correct
37 Runtime error 2 ms 512 KB Execution killed with signal 11
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 20 ms 16128 KB Output is correct
10 Correct 56 ms 17152 KB Output is correct
11 Correct 56 ms 17152 KB Output is correct
12 Correct 58 ms 17152 KB Output is correct
13 Correct 55 ms 17152 KB Output is correct
14 Correct 46 ms 8704 KB Output is correct
15 Correct 53 ms 17144 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 6 ms 9344 KB Output is correct
18 Correct 2 ms 512 KB Output is correct
19 Correct 7 ms 9472 KB Output is correct
20 Correct 1 ms 512 KB Output is correct
21 Correct 6 ms 9472 KB Output is correct
22 Correct 55 ms 17152 KB Output is correct
23 Correct 55 ms 17144 KB Output is correct
24 Correct 56 ms 17272 KB Output is correct
25 Correct 59 ms 17152 KB Output is correct
26 Correct 56 ms 17196 KB Output is correct
27 Correct 55 ms 17152 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 6 ms 8960 KB Output is correct
32 Correct 37 ms 11520 KB Output is correct
33 Correct 41 ms 15352 KB Output is correct
34 Correct 28 ms 8192 KB Output is correct
35 Correct 28 ms 7672 KB Output is correct
36 Correct 30 ms 7168 KB Output is correct
37 Correct 32 ms 2048 KB Output is correct
38 Runtime error 2 ms 512 KB Execution killed with signal 11
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 20 ms 16128 KB Output is correct
10 Correct 56 ms 17152 KB Output is correct
11 Correct 56 ms 17152 KB Output is correct
12 Correct 58 ms 17152 KB Output is correct
13 Correct 55 ms 17152 KB Output is correct
14 Correct 46 ms 8704 KB Output is correct
15 Correct 53 ms 17144 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 6 ms 9344 KB Output is correct
18 Correct 2 ms 512 KB Output is correct
19 Correct 7 ms 9472 KB Output is correct
20 Correct 1 ms 512 KB Output is correct
21 Correct 6 ms 9472 KB Output is correct
22 Correct 55 ms 17152 KB Output is correct
23 Correct 55 ms 17144 KB Output is correct
24 Correct 56 ms 17272 KB Output is correct
25 Correct 59 ms 17152 KB Output is correct
26 Correct 56 ms 17196 KB Output is correct
27 Correct 55 ms 17152 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 6 ms 8960 KB Output is correct
32 Correct 37 ms 11520 KB Output is correct
33 Correct 41 ms 15352 KB Output is correct
34 Correct 28 ms 8192 KB Output is correct
35 Correct 28 ms 7672 KB Output is correct
36 Correct 30 ms 7168 KB Output is correct
37 Correct 32 ms 2048 KB Output is correct
38 Runtime error 2 ms 512 KB Execution killed with signal 11
39 Halted 0 ms 0 KB -