답안 #377890

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
377890 2021-03-15T12:28:39 Z smjleo Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
409 ms 159212 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int long long
#define nl '\n'
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
mt19937 rng((unsigned)chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1000000007, mod2 = 998244353;

// change this
const int N = 3005;

int n, m, ao[N][N], ai[N][N], ans;
char arr[N][N];

signed main() {
    io;
    cin >> n >> m;
    for (int i=1; i<=n; i++) {
        for (int j=1; j<=m; j++) {
            cin >> arr[i][j];
            if (arr[i][j] == 'O') ao[i][j]++;
            else if (arr[i][j] == 'I') ai[i][j]++;
            ao[i][j] += ao[i][j-1];
            ai[i][j] += ai[i-1][j];
        }
    }

    for (int i=1; i<=n; i++) {
        for (int j=1; j<=m; j++) {
            if (arr[i][j] != 'J') continue;
            int x = ao[i][m] - ao[i][j], y = ai[n][j] - ai[i][j];
            ans += x * y;
        }
    }
    
    cout << ans << nl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 2 ms 1776 KB Output is correct
6 Correct 2 ms 1644 KB Output is correct
7 Correct 1 ms 1516 KB Output is correct
8 Correct 2 ms 1644 KB Output is correct
9 Correct 2 ms 1644 KB Output is correct
10 Correct 2 ms 1516 KB Output is correct
11 Correct 2 ms 1644 KB Output is correct
12 Correct 2 ms 1644 KB Output is correct
13 Correct 2 ms 1516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 2 ms 1776 KB Output is correct
6 Correct 2 ms 1644 KB Output is correct
7 Correct 1 ms 1516 KB Output is correct
8 Correct 2 ms 1644 KB Output is correct
9 Correct 2 ms 1644 KB Output is correct
10 Correct 2 ms 1516 KB Output is correct
11 Correct 2 ms 1644 KB Output is correct
12 Correct 2 ms 1644 KB Output is correct
13 Correct 2 ms 1516 KB Output is correct
14 Correct 14 ms 9068 KB Output is correct
15 Correct 4 ms 5100 KB Output is correct
16 Correct 7 ms 5356 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 15 ms 9964 KB Output is correct
19 Correct 12 ms 9836 KB Output is correct
20 Correct 12 ms 9836 KB Output is correct
21 Correct 16 ms 9964 KB Output is correct
22 Correct 13 ms 9836 KB Output is correct
23 Correct 12 ms 9836 KB Output is correct
24 Correct 16 ms 10112 KB Output is correct
25 Correct 15 ms 9868 KB Output is correct
26 Correct 11 ms 9836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 2 ms 1776 KB Output is correct
6 Correct 2 ms 1644 KB Output is correct
7 Correct 1 ms 1516 KB Output is correct
8 Correct 2 ms 1644 KB Output is correct
9 Correct 2 ms 1644 KB Output is correct
10 Correct 2 ms 1516 KB Output is correct
11 Correct 2 ms 1644 KB Output is correct
12 Correct 2 ms 1644 KB Output is correct
13 Correct 2 ms 1516 KB Output is correct
14 Correct 14 ms 9068 KB Output is correct
15 Correct 4 ms 5100 KB Output is correct
16 Correct 7 ms 5356 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 15 ms 9964 KB Output is correct
19 Correct 12 ms 9836 KB Output is correct
20 Correct 12 ms 9836 KB Output is correct
21 Correct 16 ms 9964 KB Output is correct
22 Correct 13 ms 9836 KB Output is correct
23 Correct 12 ms 9836 KB Output is correct
24 Correct 16 ms 10112 KB Output is correct
25 Correct 15 ms 9868 KB Output is correct
26 Correct 11 ms 9836 KB Output is correct
27 Correct 367 ms 158820 KB Output is correct
28 Correct 19 ms 26348 KB Output is correct
29 Correct 22 ms 13932 KB Output is correct
30 Correct 2 ms 876 KB Output is correct
31 Correct 288 ms 131436 KB Output is correct
32 Correct 323 ms 159212 KB Output is correct
33 Correct 264 ms 158572 KB Output is correct
34 Correct 332 ms 152528 KB Output is correct
35 Correct 316 ms 159192 KB Output is correct
36 Correct 279 ms 158572 KB Output is correct
37 Correct 409 ms 159212 KB Output is correct
38 Correct 228 ms 131104 KB Output is correct
39 Correct 209 ms 130924 KB Output is correct