# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
153282 | 2019-09-13T07:47:49 Z | mhy908 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 275 ms | 159384 KB |
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define llinf 8987654321987654321 #define inf 1987654321 using namespace std; typedef long long LL; typedef pair<LL, LL> pll; int n, m; char arr[3010][3010]; LL dp1[3010][3010], dp2[3010][3010]; int main() { scanf("%d %d", &n, &m); for(int i=1; i<=n; i++){ scanf("%s", arr[i]+1); } for(int i=n; i>=1; i--){ for(int j=1; j<=m; j++){ if(arr[i][j]=='I')dp1[i][j]=dp1[i+1][j]+1; else dp1[i][j]=dp1[i+1][j]; } } for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ if(arr[i][j]=='J')dp2[i][j]=dp2[i][j-1]+dp1[i][j]; else dp2[i][j]=dp2[i][j-1]; } } LL ans=0; for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ if(arr[i][j]=='O')ans+=dp2[i][j]; } } printf("%lld", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 4 ms | 1656 KB | Output is correct |
6 | Correct | 3 ms | 1528 KB | Output is correct |
7 | Correct | 4 ms | 1528 KB | Output is correct |
8 | Correct | 3 ms | 1656 KB | Output is correct |
9 | Correct | 3 ms | 1528 KB | Output is correct |
10 | Correct | 3 ms | 1400 KB | Output is correct |
11 | Correct | 4 ms | 1656 KB | Output is correct |
12 | Correct | 3 ms | 1528 KB | Output is correct |
13 | Correct | 3 ms | 1528 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 4 ms | 1656 KB | Output is correct |
6 | Correct | 3 ms | 1528 KB | Output is correct |
7 | Correct | 4 ms | 1528 KB | Output is correct |
8 | Correct | 3 ms | 1656 KB | Output is correct |
9 | Correct | 3 ms | 1528 KB | Output is correct |
10 | Correct | 3 ms | 1400 KB | Output is correct |
11 | Correct | 4 ms | 1656 KB | Output is correct |
12 | Correct | 3 ms | 1528 KB | Output is correct |
13 | Correct | 3 ms | 1528 KB | Output is correct |
14 | Correct | 14 ms | 9208 KB | Output is correct |
15 | Correct | 6 ms | 5112 KB | Output is correct |
16 | Correct | 7 ms | 5368 KB | Output is correct |
17 | Correct | 2 ms | 504 KB | Output is correct |
18 | Correct | 15 ms | 9976 KB | Output is correct |
19 | Correct | 12 ms | 9848 KB | Output is correct |
20 | Correct | 12 ms | 9852 KB | Output is correct |
21 | Correct | 15 ms | 9976 KB | Output is correct |
22 | Correct | 7 ms | 9872 KB | Output is correct |
23 | Correct | 12 ms | 9848 KB | Output is correct |
24 | Correct | 18 ms | 9976 KB | Output is correct |
25 | Correct | 12 ms | 9848 KB | Output is correct |
26 | Correct | 12 ms | 9852 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 4 ms | 1656 KB | Output is correct |
6 | Correct | 3 ms | 1528 KB | Output is correct |
7 | Correct | 4 ms | 1528 KB | Output is correct |
8 | Correct | 3 ms | 1656 KB | Output is correct |
9 | Correct | 3 ms | 1528 KB | Output is correct |
10 | Correct | 3 ms | 1400 KB | Output is correct |
11 | Correct | 4 ms | 1656 KB | Output is correct |
12 | Correct | 3 ms | 1528 KB | Output is correct |
13 | Correct | 3 ms | 1528 KB | Output is correct |
14 | Correct | 14 ms | 9208 KB | Output is correct |
15 | Correct | 6 ms | 5112 KB | Output is correct |
16 | Correct | 7 ms | 5368 KB | Output is correct |
17 | Correct | 2 ms | 504 KB | Output is correct |
18 | Correct | 15 ms | 9976 KB | Output is correct |
19 | Correct | 12 ms | 9848 KB | Output is correct |
20 | Correct | 12 ms | 9852 KB | Output is correct |
21 | Correct | 15 ms | 9976 KB | Output is correct |
22 | Correct | 7 ms | 9872 KB | Output is correct |
23 | Correct | 12 ms | 9848 KB | Output is correct |
24 | Correct | 18 ms | 9976 KB | Output is correct |
25 | Correct | 12 ms | 9848 KB | Output is correct |
26 | Correct | 12 ms | 9852 KB | Output is correct |
27 | Correct | 270 ms | 158824 KB | Output is correct |
28 | Correct | 27 ms | 26388 KB | Output is correct |
29 | Correct | 17 ms | 13944 KB | Output is correct |
30 | Correct | 3 ms | 888 KB | Output is correct |
31 | Correct | 225 ms | 131620 KB | Output is correct |
32 | Correct | 203 ms | 159352 KB | Output is correct |
33 | Correct | 190 ms | 158844 KB | Output is correct |
34 | Correct | 246 ms | 152548 KB | Output is correct |
35 | Correct | 194 ms | 159224 KB | Output is correct |
36 | Correct | 199 ms | 158824 KB | Output is correct |
37 | Correct | 275 ms | 159384 KB | Output is correct |
38 | Correct | 169 ms | 130936 KB | Output is correct |
39 | Correct | 165 ms | 131064 KB | Output is correct |