답안 #100752

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100752 2019-03-14T06:19:52 Z ikura355 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
251 ms 88440 KB
#include<bits/stdc++.h>
using namespace std;

const int maxn = 3e3 + 5;

int n,m;
char s[maxn][maxn];
long long a[maxn][maxn];

int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf(" %s",s[i]+1);
	for(int i=1;i<=n;i++) {
		int cnt = 0;
		for(int j=m;j>=1;j--) {
			cnt += s[i][j]=='O';
			a[i][j] = cnt;
		}
	}
	long long ans = 0;
	for(int j=1;j<=m;j++) {
		int cnt = 0;
		for(int i=n;i>=1;i--) {
			cnt += s[i][j]=='I';
			if(s[i][j]=='J') ans += (long long)cnt * a[i][j];
		}
	}
	printf("%lld",ans);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t1.cpp:14:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf(" %s",s[i]+1);
                        ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1152 KB Output is correct
6 Correct 3 ms 1152 KB Output is correct
7 Correct 3 ms 1024 KB Output is correct
8 Correct 3 ms 1152 KB Output is correct
9 Correct 3 ms 1152 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1152 KB Output is correct
12 Correct 3 ms 1152 KB Output is correct
13 Correct 2 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1152 KB Output is correct
6 Correct 3 ms 1152 KB Output is correct
7 Correct 3 ms 1024 KB Output is correct
8 Correct 3 ms 1152 KB Output is correct
9 Correct 3 ms 1152 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1152 KB Output is correct
12 Correct 3 ms 1152 KB Output is correct
13 Correct 2 ms 1024 KB Output is correct
14 Correct 8 ms 5376 KB Output is correct
15 Correct 5 ms 3328 KB Output is correct
16 Correct 5 ms 3200 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 11 ms 6016 KB Output is correct
19 Correct 9 ms 5888 KB Output is correct
20 Correct 9 ms 5888 KB Output is correct
21 Correct 10 ms 6016 KB Output is correct
22 Correct 9 ms 5888 KB Output is correct
23 Correct 8 ms 5888 KB Output is correct
24 Correct 9 ms 6016 KB Output is correct
25 Correct 7 ms 5888 KB Output is correct
26 Correct 8 ms 5888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1152 KB Output is correct
6 Correct 3 ms 1152 KB Output is correct
7 Correct 3 ms 1024 KB Output is correct
8 Correct 3 ms 1152 KB Output is correct
9 Correct 3 ms 1152 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1152 KB Output is correct
12 Correct 3 ms 1152 KB Output is correct
13 Correct 2 ms 1024 KB Output is correct
14 Correct 8 ms 5376 KB Output is correct
15 Correct 5 ms 3328 KB Output is correct
16 Correct 5 ms 3200 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 11 ms 6016 KB Output is correct
19 Correct 9 ms 5888 KB Output is correct
20 Correct 9 ms 5888 KB Output is correct
21 Correct 10 ms 6016 KB Output is correct
22 Correct 9 ms 5888 KB Output is correct
23 Correct 8 ms 5888 KB Output is correct
24 Correct 9 ms 6016 KB Output is correct
25 Correct 7 ms 5888 KB Output is correct
26 Correct 8 ms 5888 KB Output is correct
27 Correct 227 ms 88028 KB Output is correct
28 Correct 15 ms 16768 KB Output is correct
29 Correct 15 ms 7808 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 171 ms 72540 KB Output is correct
32 Correct 170 ms 88440 KB Output is correct
33 Correct 197 ms 88032 KB Output is correct
34 Correct 216 ms 84088 KB Output is correct
35 Correct 222 ms 88312 KB Output is correct
36 Correct 196 ms 88156 KB Output is correct
37 Correct 251 ms 88440 KB Output is correct
38 Correct 115 ms 72316 KB Output is correct
39 Correct 140 ms 72184 KB Output is correct