답안 #97322

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97322 2019-02-15T05:05:30 Z silxikys Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
1000 ms 79888 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int maxn = 3005;
char grid[maxn][maxn];
int ocnt[maxn][maxn], icnt[maxn][maxn];
int H, W;

int main()
{
    cin >> H >> W;
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            cin >> grid[i][j];
        }
    }
    for (int i = 1; i <= H; i++) {
        for (int j = W; j >= 1; j--) {
            ocnt[i][j] = ocnt[i][j+1];
            if (grid[i][j] == 'O') ocnt[i][j]++;
        }
    }
    for (int j = 1; j <= W; j++) {
        for (int i = H; i >= 1; i--) {
            icnt[i][j] = icnt[i+1][j];
            if (grid[i][j] == 'I') icnt[i][j]++;
        }
    }
    ll ans = 0;
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (grid[i][j] != 'J') continue;
            ans += ocnt[i][j] * icnt[i][j];
        }
    }
    cout << ans << '\n';
}

# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 4 ms 1456 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 4 ms 1456 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 24 ms 7296 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 14 ms 4224 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 35 ms 7800 KB Output is correct
19 Correct 29 ms 7644 KB Output is correct
20 Correct 28 ms 7672 KB Output is correct
21 Correct 33 ms 7928 KB Output is correct
22 Correct 33 ms 7676 KB Output is correct
23 Correct 25 ms 7672 KB Output is correct
24 Correct 29 ms 7680 KB Output is correct
25 Correct 33 ms 7672 KB Output is correct
26 Correct 32 ms 7552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 4 ms 1456 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 24 ms 7296 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 14 ms 4224 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 35 ms 7800 KB Output is correct
19 Correct 29 ms 7644 KB Output is correct
20 Correct 28 ms 7672 KB Output is correct
21 Correct 33 ms 7928 KB Output is correct
22 Correct 33 ms 7676 KB Output is correct
23 Correct 25 ms 7672 KB Output is correct
24 Correct 29 ms 7680 KB Output is correct
25 Correct 33 ms 7672 KB Output is correct
26 Correct 32 ms 7552 KB Output is correct
27 Execution timed out 1020 ms 79888 KB Time limit exceeded
28 Halted 0 ms 0 KB -