답안 #389883

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
389883 2021-04-14T19:10:30 Z vishesh312 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
241 ms 88640 KB
#include "bits/stdc++.h"
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
*/

#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()

using ll = long long;
const int mod = 1e9+7;

void solve(int tc) {
    int n, m;
    cin >> n >> m;
    vector<vector<char>> v(n, vector<char>(m));
    vector<vector<int>> ing(n, vector<int>(m)), orb(n, vector<int>(m));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> v[i][j];
            ing[i][j] = (v[i][j] == 'I');
            if (i) ing[i][j] += ing[i-1][j];
            orb[i][j] = (v[i][j] == 'O');
            if (j) orb[i][j] += orb[i][j-1];
        }
    }
    ll ans = 0;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            ans += (v[i][j] == 'J') * (ing[n-1][j] - ing[i][j]) * (orb[i][m-1] - orb[i][j]);
    cout << ans << '\n';
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int tc = 1;
    //cin >> tc;
    for (int i = 1; i <= tc; ++i) solve(i);
    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 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 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 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 1 ms 332 KB Output is correct
14 Correct 6 ms 2304 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 4 ms 1612 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 7 ms 2764 KB Output is correct
19 Correct 7 ms 2636 KB Output is correct
20 Correct 7 ms 2764 KB Output is correct
21 Correct 7 ms 2764 KB Output is correct
22 Correct 7 ms 2664 KB Output is correct
23 Correct 7 ms 2764 KB Output is correct
24 Correct 7 ms 2760 KB Output is correct
25 Correct 7 ms 2604 KB Output is correct
26 Correct 7 ms 2764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 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 1 ms 332 KB Output is correct
14 Correct 6 ms 2304 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 4 ms 1612 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 7 ms 2764 KB Output is correct
19 Correct 7 ms 2636 KB Output is correct
20 Correct 7 ms 2764 KB Output is correct
21 Correct 7 ms 2764 KB Output is correct
22 Correct 7 ms 2664 KB Output is correct
23 Correct 7 ms 2764 KB Output is correct
24 Correct 7 ms 2760 KB Output is correct
25 Correct 7 ms 2604 KB Output is correct
26 Correct 7 ms 2764 KB Output is correct
27 Correct 227 ms 83896 KB Output is correct
28 Correct 2 ms 844 KB Output is correct
29 Correct 18 ms 6604 KB Output is correct
30 Correct 1 ms 460 KB Output is correct
31 Correct 166 ms 61752 KB Output is correct
32 Correct 239 ms 88064 KB Output is correct
33 Correct 237 ms 88400 KB Output is correct
34 Correct 195 ms 71524 KB Output is correct
35 Correct 240 ms 88108 KB Output is correct
36 Correct 238 ms 88388 KB Output is correct
37 Correct 241 ms 88640 KB Output is correct
38 Correct 184 ms 61248 KB Output is correct
39 Correct 166 ms 61448 KB Output is correct