답안 #136745

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
136745 2019-07-26T08:06:57 Z hamzqq9 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
168 ms 88572 KB
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ii pair<int,int>
#define ll long long
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define orta ((bas+son)>>1)
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define inf 2000000000
#define N 3005
#define MOD 998244353
using namespace std;

char s[N][N];
int O[N][N],I[N][N];

int main() {

	int h,w;

	scanf("%d %d",&h,&w);

	for(int i=1;i<=h;i++) scanf("%s",s[i]+1);

	for(int i=1;i<=h;i++) {

		for(int j=1;j<=w;j++) {
		
			O[i][j]=O[i][j-1]+(s[i][j]=='O');
			I[i][j]=I[i-1][j]+(s[i][j]=='I');

		}

	}

	ll ans=0;

	for(int i=1;i<=h;i++) {

		for(int j=1;j<=w;j++) {

			if(s[i][j]=='J') {

				ans+=(I[h][j]-I[i-1][j])*(O[i][w]-O[i][j-1]);

			}

		}
 
	}

	printf("%lld",ans);

}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&h,&w);
  ~~~~~^~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:27:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=h;i++) scanf("%s",s[i]+1);
                        ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 4 ms 1528 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 4 ms 1528 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 10 ms 7544 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 6 ms 4392 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 11 ms 8056 KB Output is correct
19 Correct 10 ms 7928 KB Output is correct
20 Correct 10 ms 7800 KB Output is correct
21 Correct 17 ms 7928 KB Output is correct
22 Correct 11 ms 7928 KB Output is correct
23 Correct 10 ms 7800 KB Output is correct
24 Correct 12 ms 7928 KB Output is correct
25 Correct 10 ms 7928 KB Output is correct
26 Correct 10 ms 7928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 4 ms 1528 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 10 ms 7544 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 6 ms 4392 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 11 ms 8056 KB Output is correct
19 Correct 10 ms 7928 KB Output is correct
20 Correct 10 ms 7800 KB Output is correct
21 Correct 17 ms 7928 KB Output is correct
22 Correct 11 ms 7928 KB Output is correct
23 Correct 10 ms 7800 KB Output is correct
24 Correct 12 ms 7928 KB Output is correct
25 Correct 10 ms 7928 KB Output is correct
26 Correct 10 ms 7928 KB Output is correct
27 Correct 158 ms 88092 KB Output is correct
28 Correct 26 ms 26056 KB Output is correct
29 Correct 12 ms 7772 KB Output is correct
30 Correct 2 ms 632 KB Output is correct
31 Correct 124 ms 72568 KB Output is correct
32 Correct 133 ms 88572 KB Output is correct
33 Correct 136 ms 88412 KB Output is correct
34 Correct 144 ms 84216 KB Output is correct
35 Correct 130 ms 88440 KB Output is correct
36 Correct 126 ms 88176 KB Output is correct
37 Correct 168 ms 88440 KB Output is correct
38 Correct 101 ms 72568 KB Output is correct
39 Correct 100 ms 72376 KB Output is correct