답안 #405846

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
405846 2021-05-17T00:05:34 Z ScarletS Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
246 ms 89300 KB
#include <bits/stdc++.h>
using namespace std;

int dp[3000][3000][2];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m;
    cin>>n>>m;
    long long ans=0;
    string s[n];
    for (int i=0;i<n;++i)
        cin>>s[i];
    for (int i=n-2;i>=0;--i)
        for (int j=m-1;j>=0;--j)
            dp[i][j][0]=dp[i+1][j][0]+(s[i+1][j]=='I');
    for (int j=m-2;j>=0;--j)
        for (int i=n-1;i>=0;--i)
            dp[i][j][1]=dp[i][j+1][1]+(s[i][j+1]=='O');
    for (int i=0;i<n;++i)
        for (int j=0;j<m;++j)
            if (s[i][j]=='J')
                ans+=dp[i][j][0]*dp[i][j][1];
    cout<<ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 716 KB Output is correct
6 Correct 1 ms 716 KB Output is correct
7 Correct 1 ms 716 KB Output is correct
8 Correct 1 ms 716 KB Output is correct
9 Correct 1 ms 716 KB Output is correct
10 Correct 1 ms 716 KB Output is correct
11 Correct 1 ms 716 KB Output is correct
12 Correct 2 ms 716 KB Output is correct
13 Correct 2 ms 716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 716 KB Output is correct
6 Correct 1 ms 716 KB Output is correct
7 Correct 1 ms 716 KB Output is correct
8 Correct 1 ms 716 KB Output is correct
9 Correct 1 ms 716 KB Output is correct
10 Correct 1 ms 716 KB Output is correct
11 Correct 1 ms 716 KB Output is correct
12 Correct 2 ms 716 KB Output is correct
13 Correct 2 ms 716 KB Output is correct
14 Correct 4 ms 4172 KB Output is correct
15 Correct 2 ms 1996 KB Output is correct
16 Correct 3 ms 2508 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 5 ms 4804 KB Output is correct
19 Correct 4 ms 4556 KB Output is correct
20 Correct 4 ms 4684 KB Output is correct
21 Correct 6 ms 4684 KB Output is correct
22 Correct 4 ms 4684 KB Output is correct
23 Correct 4 ms 4684 KB Output is correct
24 Correct 5 ms 4684 KB Output is correct
25 Correct 4 ms 4556 KB Output is correct
26 Correct 4 ms 4684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 716 KB Output is correct
6 Correct 1 ms 716 KB Output is correct
7 Correct 1 ms 716 KB Output is correct
8 Correct 1 ms 716 KB Output is correct
9 Correct 1 ms 716 KB Output is correct
10 Correct 1 ms 716 KB Output is correct
11 Correct 1 ms 716 KB Output is correct
12 Correct 2 ms 716 KB Output is correct
13 Correct 2 ms 716 KB Output is correct
14 Correct 4 ms 4172 KB Output is correct
15 Correct 2 ms 1996 KB Output is correct
16 Correct 3 ms 2508 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 5 ms 4804 KB Output is correct
19 Correct 4 ms 4556 KB Output is correct
20 Correct 4 ms 4684 KB Output is correct
21 Correct 6 ms 4684 KB Output is correct
22 Correct 4 ms 4684 KB Output is correct
23 Correct 4 ms 4684 KB Output is correct
24 Correct 5 ms 4684 KB Output is correct
25 Correct 4 ms 4556 KB Output is correct
26 Correct 4 ms 4684 KB Output is correct
27 Correct 229 ms 88260 KB Output is correct
28 Correct 6 ms 9936 KB Output is correct
29 Correct 8 ms 7628 KB Output is correct
30 Correct 1 ms 460 KB Output is correct
31 Correct 169 ms 71828 KB Output is correct
32 Correct 211 ms 89156 KB Output is correct
33 Correct 203 ms 89052 KB Output is correct
34 Correct 198 ms 83276 KB Output is correct
35 Correct 220 ms 89072 KB Output is correct
36 Correct 206 ms 89156 KB Output is correct
37 Correct 246 ms 89300 KB Output is correct
38 Correct 142 ms 71440 KB Output is correct
39 Correct 141 ms 71552 KB Output is correct