답안 #531973

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
531973 2022-03-02T02:10:19 Z syl123456 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
91 ms 80440 KB
#include <bits/stdc++.h>
#define all(i) (i).begin(), (i).end()
using namespace std;
template<typename T1, typename ...T2>
void debug(bool _split, T1 i, T2 ...j) {
    if (_split)
        cerr << ", ";
    cerr << i;
    debug(true, j...);
}
#define debug(args...) cout << "Line" << __LINE__ << " : [" << #args << << "] is [" << debug(false, args) << "]" << endl;

typedef pair<int, int> pi;
typedef long long ll;

const int inf = 0x3f3f3f3f, lg = 20;
const ll mod = 1e9 + 7, INF = 0x3f3f3f3f;

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int n, m;
    cin >> n >> m;
    string s[n];
    for (string &i : s)
        cin >> i;
    int a[n][m], b[n][m];
    ll ans = 0;
    for (int i = n - 1; ~i; --i)
        for (int j = m - 1; ~j; --j) {
            a[i][j] = i < n - 1 ? a[i + 1][j] : 0;
            a[i][j] += s[i][j] == 'I';
            b[i][j] = j < m - 1 ? b[i][j + 1] : 0;
            b[i][j] += s[i][j] == 'O';
            if (s[i][j] == 'J')
                ans += a[i][j] * b[i][j];
        }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 0 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 0 ms 332 KB Output is correct
14 Correct 2 ms 1996 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
16 Correct 1 ms 1356 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 3 ms 2508 KB Output is correct
19 Correct 3 ms 2380 KB Output is correct
20 Correct 2 ms 2380 KB Output is correct
21 Correct 3 ms 2508 KB Output is correct
22 Correct 2 ms 2380 KB Output is correct
23 Correct 2 ms 2380 KB Output is correct
24 Correct 3 ms 2508 KB Output is correct
25 Correct 2 ms 2380 KB Output is correct
26 Correct 3 ms 2380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 0 ms 332 KB Output is correct
14 Correct 2 ms 1996 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
16 Correct 1 ms 1356 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 3 ms 2508 KB Output is correct
19 Correct 3 ms 2380 KB Output is correct
20 Correct 2 ms 2380 KB Output is correct
21 Correct 3 ms 2508 KB Output is correct
22 Correct 2 ms 2380 KB Output is correct
23 Correct 2 ms 2380 KB Output is correct
24 Correct 3 ms 2508 KB Output is correct
25 Correct 2 ms 2380 KB Output is correct
26 Correct 3 ms 2380 KB Output is correct
27 Correct 80 ms 76032 KB Output is correct
28 Correct 1 ms 460 KB Output is correct
29 Correct 5 ms 5964 KB Output is correct
30 Correct 1 ms 460 KB Output is correct
31 Correct 60 ms 55940 KB Output is correct
32 Correct 65 ms 79948 KB Output is correct
33 Correct 67 ms 80204 KB Output is correct
34 Correct 68 ms 64840 KB Output is correct
35 Correct 67 ms 79876 KB Output is correct
36 Correct 68 ms 80392 KB Output is correct
37 Correct 91 ms 80440 KB Output is correct
38 Correct 48 ms 55424 KB Output is correct
39 Correct 46 ms 55628 KB Output is correct