답안 #207827

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
207827 2020-03-09T07:54:47 Z kai824 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
393 ms 151288 KB
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

string mp[3005];

ll i_cnt[3005][3005];
ll o_cnt[3005][3005],ans;

int32_t main() {
    ios_base::sync_with_stdio(false);cin.tie(0);
    int h,w;
    cin>>h>>w;
    for(int x=0;x<h;x++){
      cin>>mp[x];
    }
    for(int x=0;x<h;x++){
      for(int i=w-1;i>=0;i--){
        o_cnt[x][i]=o_cnt[x][i+1];
        if(mp[x][i]=='O')o_cnt[x][i]++;
      }
    }
    for(int x=0;x<w;x++){
      for(int i=h-1;i>=0;i--){
        i_cnt[i][x]=i_cnt[i+1][x];
        if(mp[i][x]=='I')i_cnt[i][x]++;
      }
    }
    for(int x=0;x<h;x++){
      for(int y=0;y<w;y++){
        if(mp[x][y]=='J')ans+=o_cnt[x][y+1]*i_cnt[x+1][y];
      }
    }
    cout<<ans<<'\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 1272 KB Output is correct
6 Correct 6 ms 1400 KB Output is correct
7 Correct 5 ms 1272 KB Output is correct
8 Correct 5 ms 1400 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1272 KB Output is correct
11 Correct 6 ms 1400 KB Output is correct
12 Correct 5 ms 1400 KB Output is correct
13 Correct 5 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 1272 KB Output is correct
6 Correct 6 ms 1400 KB Output is correct
7 Correct 5 ms 1272 KB Output is correct
8 Correct 5 ms 1400 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1272 KB Output is correct
11 Correct 6 ms 1400 KB Output is correct
12 Correct 5 ms 1400 KB Output is correct
13 Correct 5 ms 1272 KB Output is correct
14 Correct 12 ms 7672 KB Output is correct
15 Correct 7 ms 3960 KB Output is correct
16 Correct 8 ms 4728 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 13 ms 8568 KB Output is correct
19 Correct 11 ms 8440 KB Output is correct
20 Correct 11 ms 8440 KB Output is correct
21 Correct 13 ms 8568 KB Output is correct
22 Correct 11 ms 8440 KB Output is correct
23 Correct 11 ms 8440 KB Output is correct
24 Correct 13 ms 8572 KB Output is correct
25 Correct 13 ms 8696 KB Output is correct
26 Correct 11 ms 8440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 1272 KB Output is correct
6 Correct 6 ms 1400 KB Output is correct
7 Correct 5 ms 1272 KB Output is correct
8 Correct 5 ms 1400 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1272 KB Output is correct
11 Correct 6 ms 1400 KB Output is correct
12 Correct 5 ms 1400 KB Output is correct
13 Correct 5 ms 1272 KB Output is correct
14 Correct 12 ms 7672 KB Output is correct
15 Correct 7 ms 3960 KB Output is correct
16 Correct 8 ms 4728 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 13 ms 8568 KB Output is correct
19 Correct 11 ms 8440 KB Output is correct
20 Correct 11 ms 8440 KB Output is correct
21 Correct 13 ms 8568 KB Output is correct
22 Correct 11 ms 8440 KB Output is correct
23 Correct 11 ms 8440 KB Output is correct
24 Correct 13 ms 8572 KB Output is correct
25 Correct 13 ms 8696 KB Output is correct
26 Correct 11 ms 8440 KB Output is correct
27 Correct 361 ms 150776 KB Output is correct
28 Correct 16 ms 19576 KB Output is correct
29 Correct 18 ms 13308 KB Output is correct
30 Correct 6 ms 1148 KB Output is correct
31 Correct 266 ms 124632 KB Output is correct
32 Correct 350 ms 151160 KB Output is correct
33 Correct 329 ms 150904 KB Output is correct
34 Correct 306 ms 144620 KB Output is correct
35 Correct 348 ms 151288 KB Output is correct
36 Correct 325 ms 150776 KB Output is correct
37 Correct 393 ms 151288 KB Output is correct
38 Correct 228 ms 124024 KB Output is correct
39 Correct 222 ms 124152 KB Output is correct