답안 #928491

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928491 2024-02-16T13:23:54 Z Art_ogo Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
392 ms 91216 KB
#include <bits/stdc++.h>
 
#define ll long long
#define fi first
#define se second
#define ve vector
#define all(x) x.begin(), x.end()
 
using namespace std;
 
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
 
#pragma GCC optimize("O3")
 
signed main(){
    int n, m;
    cin >> n >> m;
    ve<string> v(n);
    for(auto& i : v)
        cin >> i;
    /* for(auto i : v) */
    /*     cout << i << endl; */
    ve<ve<int> > os(n, ve<int>(m, 0)), is(n, ve<int>(m, 0));
    for(int i = 0; i < n; i++){
        os[i][m - 1] = v[i][m - 1] == 'O';
        for(int j = m - 2; j >= 0; j--)
            os[i][j] = os[i][j + 1] + int(v[i][j] == 'O');
    }
    for(int j = 0; j < m; j++){
        is[n - 1][j] = v[n - 1][j] == 'I';
        for(int i = n - 2; i >= 0; i--)
            is[i][j] = is[i + 1][j] + int(v[i][j] == 'I');
    }
    ll res = 0;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++)
            if(v[i][j] == 'J')
                res += os[i][j]*is[i][j];
    cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 416 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 416 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 5 ms 2136 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 4 ms 1788 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 7 ms 3004 KB Output is correct
19 Correct 6 ms 2652 KB Output is correct
20 Correct 6 ms 2940 KB Output is correct
21 Correct 8 ms 3164 KB Output is correct
22 Correct 6 ms 2652 KB Output is correct
23 Correct 6 ms 2908 KB Output is correct
24 Correct 7 ms 3164 KB Output is correct
25 Correct 8 ms 2752 KB Output is correct
26 Correct 9 ms 2908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 416 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 5 ms 2136 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 4 ms 1788 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 7 ms 3004 KB Output is correct
19 Correct 6 ms 2652 KB Output is correct
20 Correct 6 ms 2940 KB Output is correct
21 Correct 8 ms 3164 KB Output is correct
22 Correct 6 ms 2652 KB Output is correct
23 Correct 6 ms 2908 KB Output is correct
24 Correct 7 ms 3164 KB Output is correct
25 Correct 8 ms 2752 KB Output is correct
26 Correct 9 ms 2908 KB Output is correct
27 Correct 343 ms 86688 KB Output is correct
28 Correct 2 ms 860 KB Output is correct
29 Correct 16 ms 7108 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 258 ms 65288 KB Output is correct
32 Correct 345 ms 90664 KB Output is correct
33 Correct 316 ms 91016 KB Output is correct
34 Correct 276 ms 75516 KB Output is correct
35 Correct 363 ms 90708 KB Output is correct
36 Correct 392 ms 90964 KB Output is correct
37 Correct 337 ms 91216 KB Output is correct
38 Correct 207 ms 64528 KB Output is correct
39 Correct 213 ms 64900 KB Output is correct