답안 #938153

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
938153 2024-03-05T00:24:16 Z LittleOrange Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
326 ms 160648 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    ll h,w;
    cin >> h >> w;
    vector<string> a(h);
    for(auto &o : a) cin >> o;
    vector<vector<ll>> b(h,vector<ll>(w,0)),c(h,vector<ll>(w,0));
    ll ans = 0;
    for(ll j = w-1;j>=0;j--){
        for(ll i = h-1;i>=0;i--){
            if (a[i][j]=='O') b[i][j]++;
            if (j<w-1) b[i][j]+=b[i][j+1];
            if (a[i][j]=='I') c[i][j]++;
            if (i<h-1) c[i][j]+=c[i+1][j];
            if (a[i][j]=='J') ans += b[i][j]*c[i][j];
        }
    }
    cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 756 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 756 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 4 ms 3776 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 3 ms 2640 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 5 ms 4700 KB Output is correct
19 Correct 3 ms 4700 KB Output is correct
20 Correct 3 ms 4700 KB Output is correct
21 Correct 5 ms 4700 KB Output is correct
22 Correct 3 ms 4604 KB Output is correct
23 Correct 4 ms 4700 KB Output is correct
24 Correct 5 ms 4700 KB Output is correct
25 Correct 3 ms 4664 KB Output is correct
26 Correct 4 ms 4700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 756 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 4 ms 3776 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 3 ms 2640 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 5 ms 4700 KB Output is correct
19 Correct 3 ms 4700 KB Output is correct
20 Correct 3 ms 4700 KB Output is correct
21 Correct 5 ms 4700 KB Output is correct
22 Correct 3 ms 4604 KB Output is correct
23 Correct 4 ms 4700 KB Output is correct
24 Correct 5 ms 4700 KB Output is correct
25 Correct 3 ms 4664 KB Output is correct
26 Correct 4 ms 4700 KB Output is correct
27 Correct 299 ms 151216 KB Output is correct
28 Correct 2 ms 860 KB Output is correct
29 Correct 10 ms 11864 KB Output is correct
30 Correct 1 ms 860 KB Output is correct
31 Correct 221 ms 111184 KB Output is correct
32 Correct 315 ms 159068 KB Output is correct
33 Correct 299 ms 159576 KB Output is correct
34 Correct 239 ms 128848 KB Output is correct
35 Correct 326 ms 159412 KB Output is correct
36 Correct 319 ms 159412 KB Output is correct
37 Correct 310 ms 160648 KB Output is correct
38 Correct 192 ms 110416 KB Output is correct
39 Correct 217 ms 110892 KB Output is correct