# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
292720 |
2020-09-07T12:17:18 Z |
최은수(#5797) |
Robogolf (ROI19_golf) |
C++17 |
|
54 ms |
13304 KB |
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
const int mod=998244353;
inline int add(int x,int y)
{
return x+y<mod?x+y:x+y-mod;
}
inline int sub(int x,int y)
{
return x<y?x+mod-y:x-y;
}
inline int mul(int x,int y)
{
return(int)((ll)x*y%mod);
}
int v[1010][1010];
bool chk[1010][1010];
int dp1[1010][1010],dp2[1010][1010];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,m,k;
cin>>n>>m>>k;
for(int i=0;i<k;i++)
{
int x,y,vc;
cin>>x>>y>>vc;
chk[x][y]=1;
v[x][y]=vc;
}
int ans=0;
for(int i=n;i>0;i--)
{
for(int j=m;j>0;j--)
{
if(chk[i][j])
dp1[i][j]=dp2[i][j]=v[i][j];
else
dp1[i][j]=min(dp2[i+1][j],dp2[i][j+1]),
dp2[i][j]=max(dp1[i+1][j],dp1[i][j+1]);
ans=add(ans,(dp1[i][j]%mod+mod)%mod);
}
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
416 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
416 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
512 KB |
Output is correct |
9 |
Correct |
11 ms |
8320 KB |
Output is correct |
10 |
Correct |
54 ms |
13176 KB |
Output is correct |
11 |
Correct |
48 ms |
13176 KB |
Output is correct |
12 |
Correct |
50 ms |
13176 KB |
Output is correct |
13 |
Correct |
47 ms |
13176 KB |
Output is correct |
14 |
Correct |
42 ms |
6776 KB |
Output is correct |
15 |
Correct |
47 ms |
13208 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
7 ms |
11392 KB |
Output is correct |
18 |
Correct |
2 ms |
512 KB |
Output is correct |
19 |
Correct |
9 ms |
13184 KB |
Output is correct |
20 |
Correct |
1 ms |
512 KB |
Output is correct |
21 |
Correct |
9 ms |
11776 KB |
Output is correct |
22 |
Correct |
48 ms |
13304 KB |
Output is correct |
23 |
Correct |
48 ms |
13208 KB |
Output is correct |
24 |
Correct |
44 ms |
13176 KB |
Output is correct |
25 |
Correct |
46 ms |
13124 KB |
Output is correct |
26 |
Correct |
48 ms |
13176 KB |
Output is correct |
27 |
Correct |
49 ms |
13176 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 |
9472 KB |
Output is correct |
32 |
Correct |
34 ms |
8952 KB |
Output is correct |
33 |
Correct |
38 ms |
11768 KB |
Output is correct |
34 |
Correct |
26 ms |
6400 KB |
Output is correct |
35 |
Correct |
27 ms |
6136 KB |
Output is correct |
36 |
Correct |
27 ms |
5888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Incorrect |
6 ms |
512 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
1656 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 |
416 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
416 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
512 KB |
Output is correct |
9 |
Correct |
11 ms |
8320 KB |
Output is correct |
10 |
Correct |
54 ms |
13176 KB |
Output is correct |
11 |
Correct |
48 ms |
13176 KB |
Output is correct |
12 |
Correct |
50 ms |
13176 KB |
Output is correct |
13 |
Correct |
47 ms |
13176 KB |
Output is correct |
14 |
Correct |
42 ms |
6776 KB |
Output is correct |
15 |
Correct |
47 ms |
13208 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
7 ms |
11392 KB |
Output is correct |
18 |
Correct |
2 ms |
512 KB |
Output is correct |
19 |
Correct |
9 ms |
13184 KB |
Output is correct |
20 |
Correct |
1 ms |
512 KB |
Output is correct |
21 |
Correct |
9 ms |
11776 KB |
Output is correct |
22 |
Correct |
48 ms |
13304 KB |
Output is correct |
23 |
Correct |
48 ms |
13208 KB |
Output is correct |
24 |
Correct |
44 ms |
13176 KB |
Output is correct |
25 |
Correct |
46 ms |
13124 KB |
Output is correct |
26 |
Correct |
48 ms |
13176 KB |
Output is correct |
27 |
Correct |
49 ms |
13176 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 |
9472 KB |
Output is correct |
32 |
Correct |
34 ms |
8952 KB |
Output is correct |
33 |
Correct |
38 ms |
11768 KB |
Output is correct |
34 |
Correct |
26 ms |
6400 KB |
Output is correct |
35 |
Correct |
27 ms |
6136 KB |
Output is correct |
36 |
Correct |
27 ms |
5888 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 |
416 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
416 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
512 KB |
Output is correct |
9 |
Correct |
11 ms |
8320 KB |
Output is correct |
10 |
Correct |
54 ms |
13176 KB |
Output is correct |
11 |
Correct |
48 ms |
13176 KB |
Output is correct |
12 |
Correct |
50 ms |
13176 KB |
Output is correct |
13 |
Correct |
47 ms |
13176 KB |
Output is correct |
14 |
Correct |
42 ms |
6776 KB |
Output is correct |
15 |
Correct |
47 ms |
13208 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
7 ms |
11392 KB |
Output is correct |
18 |
Correct |
2 ms |
512 KB |
Output is correct |
19 |
Correct |
9 ms |
13184 KB |
Output is correct |
20 |
Correct |
1 ms |
512 KB |
Output is correct |
21 |
Correct |
9 ms |
11776 KB |
Output is correct |
22 |
Correct |
48 ms |
13304 KB |
Output is correct |
23 |
Correct |
48 ms |
13208 KB |
Output is correct |
24 |
Correct |
44 ms |
13176 KB |
Output is correct |
25 |
Correct |
46 ms |
13124 KB |
Output is correct |
26 |
Correct |
48 ms |
13176 KB |
Output is correct |
27 |
Correct |
49 ms |
13176 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 |
9472 KB |
Output is correct |
32 |
Correct |
34 ms |
8952 KB |
Output is correct |
33 |
Correct |
38 ms |
11768 KB |
Output is correct |
34 |
Correct |
26 ms |
6400 KB |
Output is correct |
35 |
Correct |
27 ms |
6136 KB |
Output is correct |
36 |
Correct |
27 ms |
5888 KB |
Output is correct |
37 |
Correct |
32 ms |
1656 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 |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
416 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
416 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
512 KB |
Output is correct |
9 |
Correct |
11 ms |
8320 KB |
Output is correct |
10 |
Correct |
54 ms |
13176 KB |
Output is correct |
11 |
Correct |
48 ms |
13176 KB |
Output is correct |
12 |
Correct |
50 ms |
13176 KB |
Output is correct |
13 |
Correct |
47 ms |
13176 KB |
Output is correct |
14 |
Correct |
42 ms |
6776 KB |
Output is correct |
15 |
Correct |
47 ms |
13208 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
7 ms |
11392 KB |
Output is correct |
18 |
Correct |
2 ms |
512 KB |
Output is correct |
19 |
Correct |
9 ms |
13184 KB |
Output is correct |
20 |
Correct |
1 ms |
512 KB |
Output is correct |
21 |
Correct |
9 ms |
11776 KB |
Output is correct |
22 |
Correct |
48 ms |
13304 KB |
Output is correct |
23 |
Correct |
48 ms |
13208 KB |
Output is correct |
24 |
Correct |
44 ms |
13176 KB |
Output is correct |
25 |
Correct |
46 ms |
13124 KB |
Output is correct |
26 |
Correct |
48 ms |
13176 KB |
Output is correct |
27 |
Correct |
49 ms |
13176 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 |
9472 KB |
Output is correct |
32 |
Correct |
34 ms |
8952 KB |
Output is correct |
33 |
Correct |
38 ms |
11768 KB |
Output is correct |
34 |
Correct |
26 ms |
6400 KB |
Output is correct |
35 |
Correct |
27 ms |
6136 KB |
Output is correct |
36 |
Correct |
27 ms |
5888 KB |
Output is correct |
37 |
Correct |
32 ms |
1656 KB |
Output is correct |
38 |
Runtime error |
2 ms |
512 KB |
Execution killed with signal 11 |
39 |
Halted |
0 ms |
0 KB |
- |