답안 #717563

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
717563 2023-04-02T08:12:39 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
359 ms 104460 KB
#include <bits/stdc++.h>

using namespace std;

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

vector<pii> posJ;
vector<vector<int> > cntO(3010, vector<int> (3010, 0)), cntI(3010, vector<int> (3010, 0));
int n, m;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            char c; cin >> c;
            if(c == 'J') posJ.push_back({i, j});
            else if(c == 'O') cntO[i][j]++;
            else cntI[i][j]++;
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int l = m - 1; l >= 1; l--) {
            cntO[i][l] += cntO[i][l + 1]; 
        }
    }
    for(int j = 1; j <= m; j++) {
        for(int k = n - 1; k >= 1; k--) {
            cntI[k][j] += cntI[k + 1][j];
        }
    }
    ll res = 0;
    for(auto [i, j] : posJ) {
        res += (cntO[i][j + 1] * cntI[i + 1][j]);
    }
    cout << res << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 71328 KB Output is correct
2 Correct 29 ms 71392 KB Output is correct
3 Correct 30 ms 71336 KB Output is correct
4 Correct 28 ms 71380 KB Output is correct
5 Correct 30 ms 71416 KB Output is correct
6 Correct 36 ms 71384 KB Output is correct
7 Correct 29 ms 71380 KB Output is correct
8 Correct 29 ms 71380 KB Output is correct
9 Correct 29 ms 71436 KB Output is correct
10 Correct 30 ms 71376 KB Output is correct
11 Correct 31 ms 71452 KB Output is correct
12 Correct 31 ms 71456 KB Output is correct
13 Correct 30 ms 71380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 71328 KB Output is correct
2 Correct 29 ms 71392 KB Output is correct
3 Correct 30 ms 71336 KB Output is correct
4 Correct 28 ms 71380 KB Output is correct
5 Correct 30 ms 71416 KB Output is correct
6 Correct 36 ms 71384 KB Output is correct
7 Correct 29 ms 71380 KB Output is correct
8 Correct 29 ms 71380 KB Output is correct
9 Correct 29 ms 71436 KB Output is correct
10 Correct 30 ms 71376 KB Output is correct
11 Correct 31 ms 71452 KB Output is correct
12 Correct 31 ms 71456 KB Output is correct
13 Correct 30 ms 71380 KB Output is correct
14 Correct 34 ms 72032 KB Output is correct
15 Correct 29 ms 71452 KB Output is correct
16 Correct 34 ms 72028 KB Output is correct
17 Correct 32 ms 71408 KB Output is correct
18 Correct 38 ms 72556 KB Output is correct
19 Correct 36 ms 71764 KB Output is correct
20 Correct 35 ms 72528 KB Output is correct
21 Correct 38 ms 72512 KB Output is correct
22 Correct 35 ms 72500 KB Output is correct
23 Correct 34 ms 72528 KB Output is correct
24 Correct 48 ms 72532 KB Output is correct
25 Correct 40 ms 71764 KB Output is correct
26 Correct 36 ms 72580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 71328 KB Output is correct
2 Correct 29 ms 71392 KB Output is correct
3 Correct 30 ms 71336 KB Output is correct
4 Correct 28 ms 71380 KB Output is correct
5 Correct 30 ms 71416 KB Output is correct
6 Correct 36 ms 71384 KB Output is correct
7 Correct 29 ms 71380 KB Output is correct
8 Correct 29 ms 71380 KB Output is correct
9 Correct 29 ms 71436 KB Output is correct
10 Correct 30 ms 71376 KB Output is correct
11 Correct 31 ms 71452 KB Output is correct
12 Correct 31 ms 71456 KB Output is correct
13 Correct 30 ms 71380 KB Output is correct
14 Correct 34 ms 72032 KB Output is correct
15 Correct 29 ms 71452 KB Output is correct
16 Correct 34 ms 72028 KB Output is correct
17 Correct 32 ms 71408 KB Output is correct
18 Correct 38 ms 72556 KB Output is correct
19 Correct 36 ms 71764 KB Output is correct
20 Correct 35 ms 72528 KB Output is correct
21 Correct 38 ms 72512 KB Output is correct
22 Correct 35 ms 72500 KB Output is correct
23 Correct 34 ms 72528 KB Output is correct
24 Correct 48 ms 72532 KB Output is correct
25 Correct 40 ms 71764 KB Output is correct
26 Correct 36 ms 72580 KB Output is correct
27 Correct 321 ms 104460 KB Output is correct
28 Correct 31 ms 71528 KB Output is correct
29 Correct 52 ms 73580 KB Output is correct
30 Correct 32 ms 71460 KB Output is correct
31 Correct 265 ms 87944 KB Output is correct
32 Correct 326 ms 79808 KB Output is correct
33 Correct 279 ms 104368 KB Output is correct
34 Correct 327 ms 104296 KB Output is correct
35 Correct 318 ms 104400 KB Output is correct
36 Correct 308 ms 104340 KB Output is correct
37 Correct 359 ms 104296 KB Output is correct
38 Correct 218 ms 79772 KB Output is correct
39 Correct 223 ms 87956 KB Output is correct