답안 #1023577

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1023577 2024-07-15T03:08:28 Z danglayloi1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
226 ms 247632 KB
#include <bits/stdc++.h>
#define ii pair<int, int>
#define fi first
#define se second
#define inf 0x3f3f3f3f3f3f3f3f
using namespace std;
using ll = long long;
const ll mod=1e9+7;
const int nx=3e3+5;
int n, m, a[nx][nx], r[nx][nx][3], c[nx][nx][3];
ll ans=0;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n>>m;
    for(int i = 1; i <= n; i++)
    {
        string s;
        cin>>s;
        for(int j = 1; j <= m; j++)
        {
            if(s[j-1]=='J')
                a[i][j]=0;
            else if(s[j-1]=='O')
                a[i][j]=1;
            else a[i][j]=2;
            for(int k = 0; k < 3; k++)
            {
                r[i][j][k]=r[i-1][j][k]+(a[i][j]==k);
                c[i][j][k]=c[i][j-1][k]+(a[i][j]==k);
            }
        }
    }
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            if(a[i][j]==0)
                ans+=(r[n][j][2]-r[i][j][2])*(c[i][m][1]-c[i][j][1]);
        }
    }
    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 7260 KB Output is correct
6 Correct 1 ms 7004 KB Output is correct
7 Correct 1 ms 7004 KB Output is correct
8 Correct 1 ms 7260 KB Output is correct
9 Correct 1 ms 7004 KB Output is correct
10 Correct 1 ms 7004 KB Output is correct
11 Correct 1 ms 7260 KB Output is correct
12 Correct 1 ms 7004 KB Output is correct
13 Correct 1 ms 7004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 7260 KB Output is correct
6 Correct 1 ms 7004 KB Output is correct
7 Correct 1 ms 7004 KB Output is correct
8 Correct 1 ms 7260 KB Output is correct
9 Correct 1 ms 7004 KB Output is correct
10 Correct 1 ms 7004 KB Output is correct
11 Correct 1 ms 7260 KB Output is correct
12 Correct 1 ms 7004 KB Output is correct
13 Correct 1 ms 7004 KB Output is correct
14 Correct 8 ms 21852 KB Output is correct
15 Correct 3 ms 19036 KB Output is correct
16 Correct 4 ms 19104 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 8 ms 26972 KB Output is correct
19 Correct 7 ms 25180 KB Output is correct
20 Correct 9 ms 26716 KB Output is correct
21 Correct 9 ms 25436 KB Output is correct
22 Correct 6 ms 26716 KB Output is correct
23 Correct 6 ms 26716 KB Output is correct
24 Correct 9 ms 28488 KB Output is correct
25 Correct 7 ms 26716 KB Output is correct
26 Correct 6 ms 27996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 7260 KB Output is correct
6 Correct 1 ms 7004 KB Output is correct
7 Correct 1 ms 7004 KB Output is correct
8 Correct 1 ms 7260 KB Output is correct
9 Correct 1 ms 7004 KB Output is correct
10 Correct 1 ms 7004 KB Output is correct
11 Correct 1 ms 7260 KB Output is correct
12 Correct 1 ms 7004 KB Output is correct
13 Correct 1 ms 7004 KB Output is correct
14 Correct 8 ms 21852 KB Output is correct
15 Correct 3 ms 19036 KB Output is correct
16 Correct 4 ms 19104 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 8 ms 26972 KB Output is correct
19 Correct 7 ms 25180 KB Output is correct
20 Correct 9 ms 26716 KB Output is correct
21 Correct 9 ms 25436 KB Output is correct
22 Correct 6 ms 26716 KB Output is correct
23 Correct 6 ms 26716 KB Output is correct
24 Correct 9 ms 28488 KB Output is correct
25 Correct 7 ms 26716 KB Output is correct
26 Correct 6 ms 27996 KB Output is correct
27 Correct 222 ms 247376 KB Output is correct
28 Correct 14 ms 47964 KB Output is correct
29 Correct 7 ms 23900 KB Output is correct
30 Correct 1 ms 4956 KB Output is correct
31 Correct 156 ms 198084 KB Output is correct
32 Correct 196 ms 247632 KB Output is correct
33 Correct 138 ms 247120 KB Output is correct
34 Correct 182 ms 229460 KB Output is correct
35 Correct 163 ms 247576 KB Output is correct
36 Correct 142 ms 246916 KB Output is correct
37 Correct 226 ms 247380 KB Output is correct
38 Correct 114 ms 196912 KB Output is correct
39 Correct 119 ms 197204 KB Output is correct