답안 #718307

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
718307 2023-04-03T20:12:58 Z Yell0 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
141 ms 158888 KB
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const int MN=3002;
int H,W;
ll sfr[MN][MN],sfc[MN][MN];
char gr[MN][MN];
 
int main() {
  ios::sync_with_stdio(0);cin.tie(0);
  cin>>H>>W;
  for(int i=1;i<=H;++i) cin>>gr[i]+1;
  for(int i=1;i<=H;++i)
    for(int j=W;j>0;--j) sfr[i][j]=sfr[i][j+1]+(gr[i][j]=='O');
  for(int i=H;i>0;--i)
    for(int j=1;j<=W;++j) sfc[i][j]=sfc[i+1][j]+(gr[i][j]=='I');
  ll ans=0;
  for(int i=1;i<=H;++i)
    for(int j=1;j<=W;++j)
      if(gr[i][j]=='J') ans+=sfr[i][j]*sfc[i][j];
  cout<<ans<<'\n';
  return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:13:35: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   13 |   for(int i=1;i<=H;++i) cin>>gr[i]+1;
      |                              ~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1496 KB Output is correct
8 Correct 1 ms 1496 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 1 ms 1620 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1496 KB Output is correct
8 Correct 1 ms 1496 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 1 ms 1620 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1492 KB Output is correct
14 Correct 6 ms 8956 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 4 ms 5308 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 7 ms 9940 KB Output is correct
19 Correct 6 ms 9816 KB Output is correct
20 Correct 6 ms 9812 KB Output is correct
21 Correct 8 ms 9944 KB Output is correct
22 Correct 7 ms 9812 KB Output is correct
23 Correct 7 ms 9796 KB Output is correct
24 Correct 7 ms 9908 KB Output is correct
25 Correct 6 ms 9812 KB Output is correct
26 Correct 6 ms 9812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1496 KB Output is correct
8 Correct 1 ms 1496 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 1 ms 1620 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1492 KB Output is correct
14 Correct 6 ms 8956 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 4 ms 5308 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 7 ms 9940 KB Output is correct
19 Correct 6 ms 9816 KB Output is correct
20 Correct 6 ms 9812 KB Output is correct
21 Correct 8 ms 9944 KB Output is correct
22 Correct 7 ms 9812 KB Output is correct
23 Correct 7 ms 9796 KB Output is correct
24 Correct 7 ms 9908 KB Output is correct
25 Correct 6 ms 9812 KB Output is correct
26 Correct 6 ms 9812 KB Output is correct
27 Correct 141 ms 158308 KB Output is correct
28 Correct 13 ms 26324 KB Output is correct
29 Correct 10 ms 13840 KB Output is correct
30 Correct 1 ms 728 KB Output is correct
31 Correct 105 ms 131212 KB Output is correct
32 Correct 115 ms 158760 KB Output is correct
33 Correct 117 ms 158388 KB Output is correct
34 Correct 124 ms 152160 KB Output is correct
35 Correct 118 ms 158780 KB Output is correct
36 Correct 110 ms 158364 KB Output is correct
37 Correct 139 ms 158888 KB Output is correct
38 Correct 92 ms 130736 KB Output is correct
39 Correct 79 ms 130672 KB Output is correct