Submission #292926

# Submission time Handle Problem Language Result Execution time Memory
292926 2020-09-07T14:50:36 Z 송준혁(#5803) Robogolf (ROI19_golf) C++17
20 / 100
88 ms 13184 KB
#include <bits/stdc++.h>
#define MOD 998244353
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

int N, M, K, ans;
int A[1010][1010], D1[1010][1010], D2[1010][1010];
bool chk[1010][1010];

int main(){
	scanf("%d %d %d", &N, &M, &K);
	for (int i=1; i<=K; i++){
		int x, y, v;
		scanf("%d %d %d", &x, &y, &v);
		chk[x][y] = true, A[x][y] = v;
	}
	for (int i=N; i>=1; i--) for (int j=M; j>=1; j--){
		D1[i][j] = min(D2[i+1][j], D2[i][j+1]);
		D2[i][j] = max(D1[i+1][j], D1[i][j+1]);
		if (chk[i][j]) D1[i][j] = D2[i][j] = A[i][j];
	}
	for (int i=1; i<=N; i++) for (int j=1; j<=M; j++) ans = (ans + D1[i][j]) % MOD, ans = (ans + MOD)%MOD;
	printf("%d\n", ans);
	return 0;
}

Compilation message

golf.cpp: In function 'int main()':
golf.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |  scanf("%d %d %d", &N, &M, &K);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
golf.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |   scanf("%d %d %d", &x, &y, &v);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 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 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Correct 17 ms 8320 KB Output is correct
10 Correct 65 ms 13176 KB Output is correct
11 Correct 74 ms 13124 KB Output is correct
12 Correct 64 ms 13176 KB Output is correct
13 Correct 88 ms 13176 KB Output is correct
14 Correct 53 ms 6776 KB Output is correct
15 Correct 58 ms 13180 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 7 ms 11392 KB Output is correct
18 Correct 4 ms 512 KB Output is correct
19 Correct 10 ms 13184 KB Output is correct
20 Correct 1 ms 512 KB Output is correct
21 Correct 8 ms 11776 KB Output is correct
22 Correct 85 ms 13176 KB Output is correct
23 Correct 85 ms 13176 KB Output is correct
24 Correct 63 ms 13176 KB Output is correct
25 Correct 66 ms 13120 KB Output is correct
26 Correct 69 ms 13124 KB Output is correct
27 Correct 67 ms 13176 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 7 ms 9472 KB Output is correct
32 Correct 46 ms 8876 KB Output is correct
33 Correct 63 ms 11776 KB Output is correct
34 Correct 34 ms 6392 KB Output is correct
35 Correct 37 ms 6264 KB Output is correct
36 Correct 34 ms 5880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Incorrect 10 ms 512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 46 ms 1624 KB Output is correct
2 Runtime error 2 ms 384 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 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Correct 17 ms 8320 KB Output is correct
10 Correct 65 ms 13176 KB Output is correct
11 Correct 74 ms 13124 KB Output is correct
12 Correct 64 ms 13176 KB Output is correct
13 Correct 88 ms 13176 KB Output is correct
14 Correct 53 ms 6776 KB Output is correct
15 Correct 58 ms 13180 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 7 ms 11392 KB Output is correct
18 Correct 4 ms 512 KB Output is correct
19 Correct 10 ms 13184 KB Output is correct
20 Correct 1 ms 512 KB Output is correct
21 Correct 8 ms 11776 KB Output is correct
22 Correct 85 ms 13176 KB Output is correct
23 Correct 85 ms 13176 KB Output is correct
24 Correct 63 ms 13176 KB Output is correct
25 Correct 66 ms 13120 KB Output is correct
26 Correct 69 ms 13124 KB Output is correct
27 Correct 67 ms 13176 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 7 ms 9472 KB Output is correct
32 Correct 46 ms 8876 KB Output is correct
33 Correct 63 ms 11776 KB Output is correct
34 Correct 34 ms 6392 KB Output is correct
35 Correct 37 ms 6264 KB Output is correct
36 Correct 34 ms 5880 KB Output is correct
37 Runtime error 1 ms 384 KB Execution killed with signal 11
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 384 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 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Correct 17 ms 8320 KB Output is correct
10 Correct 65 ms 13176 KB Output is correct
11 Correct 74 ms 13124 KB Output is correct
12 Correct 64 ms 13176 KB Output is correct
13 Correct 88 ms 13176 KB Output is correct
14 Correct 53 ms 6776 KB Output is correct
15 Correct 58 ms 13180 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 7 ms 11392 KB Output is correct
18 Correct 4 ms 512 KB Output is correct
19 Correct 10 ms 13184 KB Output is correct
20 Correct 1 ms 512 KB Output is correct
21 Correct 8 ms 11776 KB Output is correct
22 Correct 85 ms 13176 KB Output is correct
23 Correct 85 ms 13176 KB Output is correct
24 Correct 63 ms 13176 KB Output is correct
25 Correct 66 ms 13120 KB Output is correct
26 Correct 69 ms 13124 KB Output is correct
27 Correct 67 ms 13176 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 7 ms 9472 KB Output is correct
32 Correct 46 ms 8876 KB Output is correct
33 Correct 63 ms 11776 KB Output is correct
34 Correct 34 ms 6392 KB Output is correct
35 Correct 37 ms 6264 KB Output is correct
36 Correct 34 ms 5880 KB Output is correct
37 Correct 46 ms 1624 KB Output is correct
38 Runtime error 2 ms 384 KB Execution killed with signal 11
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 384 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 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Correct 17 ms 8320 KB Output is correct
10 Correct 65 ms 13176 KB Output is correct
11 Correct 74 ms 13124 KB Output is correct
12 Correct 64 ms 13176 KB Output is correct
13 Correct 88 ms 13176 KB Output is correct
14 Correct 53 ms 6776 KB Output is correct
15 Correct 58 ms 13180 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 7 ms 11392 KB Output is correct
18 Correct 4 ms 512 KB Output is correct
19 Correct 10 ms 13184 KB Output is correct
20 Correct 1 ms 512 KB Output is correct
21 Correct 8 ms 11776 KB Output is correct
22 Correct 85 ms 13176 KB Output is correct
23 Correct 85 ms 13176 KB Output is correct
24 Correct 63 ms 13176 KB Output is correct
25 Correct 66 ms 13120 KB Output is correct
26 Correct 69 ms 13124 KB Output is correct
27 Correct 67 ms 13176 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 7 ms 9472 KB Output is correct
32 Correct 46 ms 8876 KB Output is correct
33 Correct 63 ms 11776 KB Output is correct
34 Correct 34 ms 6392 KB Output is correct
35 Correct 37 ms 6264 KB Output is correct
36 Correct 34 ms 5880 KB Output is correct
37 Correct 46 ms 1624 KB Output is correct
38 Runtime error 2 ms 384 KB Execution killed with signal 11
39 Halted 0 ms 0 KB -