답안 #949346

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
949346 2024-03-19T06:41:50 Z tnknguyen_ Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
179 ms 160080 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n' 

const int sz = 3005;
char a[sz][sz];
int s[3][sz][sz];

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //freopen("JOI19_ho_t1.inp","r",stdin);
    //freopen("JOI19_ho_t1.out","w",stdout);

    int n, m;
    cin>>n>>m;

    for(int i=1; i<=n; ++i){
        for(int j=1; j<=m; ++j){
            cin>>a[i][j];
            s[0][i][j] = s[0][i][j-1] + (a[i][j] == 'O');
            s[1][i][j] = s[1][i-1][j] + (a[i][j] == 'I');
        }
    }

    int ans = 0;
    for(int i=1; i<=n; ++i){
        for(int j=1; j<=m; ++j){
            if(a[i][j] == 'J'){
                int x = s[1][n][j] - s[1][i][j];
                int y = s[0][i][m] - s[0][i][j];
                ans += (x * y);
            }
        }
    }
    cout<<ans;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 2 ms 7260 KB Output is correct
6 Correct 2 ms 7340 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 2 ms 7260 KB Output is correct
9 Correct 2 ms 7260 KB Output is correct
10 Correct 1 ms 5208 KB Output is correct
11 Correct 2 ms 7260 KB Output is correct
12 Correct 1 ms 7260 KB Output is correct
13 Correct 1 ms 5212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 2 ms 7260 KB Output is correct
6 Correct 2 ms 7340 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 2 ms 7260 KB Output is correct
9 Correct 2 ms 7260 KB Output is correct
10 Correct 1 ms 5208 KB Output is correct
11 Correct 2 ms 7260 KB Output is correct
12 Correct 1 ms 7260 KB Output is correct
13 Correct 1 ms 5212 KB Output is correct
14 Correct 6 ms 20316 KB Output is correct
15 Correct 3 ms 14680 KB Output is correct
16 Correct 5 ms 12632 KB Output is correct
17 Correct 1 ms 2652 KB Output is correct
18 Correct 7 ms 20828 KB Output is correct
19 Correct 7 ms 20596 KB Output is correct
20 Correct 6 ms 18524 KB Output is correct
21 Correct 7 ms 20828 KB Output is correct
22 Correct 7 ms 20572 KB Output is correct
23 Correct 6 ms 18520 KB Output is correct
24 Correct 7 ms 20824 KB Output is correct
25 Correct 6 ms 20572 KB Output is correct
26 Correct 6 ms 18524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 2 ms 7260 KB Output is correct
6 Correct 2 ms 7340 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 2 ms 7260 KB Output is correct
9 Correct 2 ms 7260 KB Output is correct
10 Correct 1 ms 5208 KB Output is correct
11 Correct 2 ms 7260 KB Output is correct
12 Correct 1 ms 7260 KB Output is correct
13 Correct 1 ms 5212 KB Output is correct
14 Correct 6 ms 20316 KB Output is correct
15 Correct 3 ms 14680 KB Output is correct
16 Correct 5 ms 12632 KB Output is correct
17 Correct 1 ms 2652 KB Output is correct
18 Correct 7 ms 20828 KB Output is correct
19 Correct 7 ms 20596 KB Output is correct
20 Correct 6 ms 18524 KB Output is correct
21 Correct 7 ms 20828 KB Output is correct
22 Correct 7 ms 20572 KB Output is correct
23 Correct 6 ms 18520 KB Output is correct
24 Correct 7 ms 20824 KB Output is correct
25 Correct 6 ms 20572 KB Output is correct
26 Correct 6 ms 18524 KB Output is correct
27 Correct 179 ms 159704 KB Output is correct
28 Correct 13 ms 71772 KB Output is correct
29 Correct 10 ms 16732 KB Output is correct
30 Correct 1 ms 2908 KB Output is correct
31 Correct 100 ms 135136 KB Output is correct
32 Correct 120 ms 160044 KB Output is correct
33 Correct 122 ms 160044 KB Output is correct
34 Correct 131 ms 155472 KB Output is correct
35 Correct 128 ms 160080 KB Output is correct
36 Correct 114 ms 159668 KB Output is correct
37 Correct 140 ms 160080 KB Output is correct
38 Correct 87 ms 134996 KB Output is correct
39 Correct 88 ms 132948 KB Output is correct