답안 #499595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499595 2021-12-28T22:28:37 Z Marceantasy Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
76 ms 21952 KB
#include <bits/stdc++.h>
using namespace std; 

#define ll long long
#define ar array

const int mxN = 1e5+1, M = 1e9+7; 
int n, m, a[mxN];
string s[mxN];

int main(){
#ifdef _DEBUG
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
    std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);

    cin >> n >> m; 
    for(int i = 0; i<n; ++i){
        cin >> s[i];
    }
    ll ans = 0;
    for(int i = n-1; i>=0; --i){
        int b = 0;
        for(int j = m-1; j>=0; --j){
            if(s[i][j] == 'J'){
                ans += a[j]*b;
            }else if(s[i][j] == 'O'){
                b++;
            }else{
                a[j]++;
            }
        }
    }
    cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3448 KB Output is correct
2 Correct 2 ms 3444 KB Output is correct
3 Correct 2 ms 3404 KB Output is correct
4 Correct 2 ms 3404 KB Output is correct
5 Correct 2 ms 3404 KB Output is correct
6 Correct 2 ms 3404 KB Output is correct
7 Correct 2 ms 3404 KB Output is correct
8 Correct 2 ms 3404 KB Output is correct
9 Correct 2 ms 3404 KB Output is correct
10 Correct 2 ms 3404 KB Output is correct
11 Correct 2 ms 3404 KB Output is correct
12 Correct 2 ms 3424 KB Output is correct
13 Correct 2 ms 3404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3448 KB Output is correct
2 Correct 2 ms 3444 KB Output is correct
3 Correct 2 ms 3404 KB Output is correct
4 Correct 2 ms 3404 KB Output is correct
5 Correct 2 ms 3404 KB Output is correct
6 Correct 2 ms 3404 KB Output is correct
7 Correct 2 ms 3404 KB Output is correct
8 Correct 2 ms 3404 KB Output is correct
9 Correct 2 ms 3404 KB Output is correct
10 Correct 2 ms 3404 KB Output is correct
11 Correct 2 ms 3404 KB Output is correct
12 Correct 2 ms 3424 KB Output is correct
13 Correct 2 ms 3404 KB Output is correct
14 Correct 3 ms 3788 KB Output is correct
15 Correct 2 ms 3404 KB Output is correct
16 Correct 2 ms 3660 KB Output is correct
17 Correct 2 ms 3404 KB Output is correct
18 Correct 4 ms 3840 KB Output is correct
19 Correct 2 ms 3828 KB Output is correct
20 Correct 2 ms 3832 KB Output is correct
21 Correct 4 ms 3916 KB Output is correct
22 Correct 2 ms 3836 KB Output is correct
23 Correct 2 ms 3904 KB Output is correct
24 Correct 4 ms 3928 KB Output is correct
25 Correct 3 ms 3808 KB Output is correct
26 Correct 2 ms 3908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3448 KB Output is correct
2 Correct 2 ms 3444 KB Output is correct
3 Correct 2 ms 3404 KB Output is correct
4 Correct 2 ms 3404 KB Output is correct
5 Correct 2 ms 3404 KB Output is correct
6 Correct 2 ms 3404 KB Output is correct
7 Correct 2 ms 3404 KB Output is correct
8 Correct 2 ms 3404 KB Output is correct
9 Correct 2 ms 3404 KB Output is correct
10 Correct 2 ms 3404 KB Output is correct
11 Correct 2 ms 3404 KB Output is correct
12 Correct 2 ms 3424 KB Output is correct
13 Correct 2 ms 3404 KB Output is correct
14 Correct 3 ms 3788 KB Output is correct
15 Correct 2 ms 3404 KB Output is correct
16 Correct 2 ms 3660 KB Output is correct
17 Correct 2 ms 3404 KB Output is correct
18 Correct 4 ms 3840 KB Output is correct
19 Correct 2 ms 3828 KB Output is correct
20 Correct 2 ms 3832 KB Output is correct
21 Correct 4 ms 3916 KB Output is correct
22 Correct 2 ms 3836 KB Output is correct
23 Correct 2 ms 3904 KB Output is correct
24 Correct 4 ms 3928 KB Output is correct
25 Correct 3 ms 3808 KB Output is correct
26 Correct 2 ms 3908 KB Output is correct
27 Correct 74 ms 20832 KB Output is correct
28 Correct 2 ms 3456 KB Output is correct
29 Correct 4 ms 4676 KB Output is correct
30 Correct 2 ms 3404 KB Output is correct
31 Correct 54 ms 16124 KB Output is correct
32 Correct 34 ms 21688 KB Output is correct
33 Correct 28 ms 21888 KB Output is correct
34 Correct 63 ms 18192 KB Output is correct
35 Correct 32 ms 21804 KB Output is correct
36 Correct 27 ms 21848 KB Output is correct
37 Correct 76 ms 21952 KB Output is correct
38 Correct 24 ms 16068 KB Output is correct
39 Correct 20 ms 16096 KB Output is correct