Submission #121040

# Submission time Handle Problem Language Result Execution time Memory
121040 2019-06-26T03:47:30 Z 김세빈(#2968) Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
350 ms 152544 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

char S[3030][3030];
ll X[3030][3030], Y[3030][3030];
ll n, m, ans;

int main()
{
	ll i, j, s;

	scanf("%lld%lld", &n, &m);

	for(i=0; i<n; i++){
		scanf("%s", S[i]);
	}

	for(i=0; i<n; i++){
		for(j=m-1, s=0; j>=0; j--){
			if(S[i][j] == 'J') X[i][j] = s;
			else if(S[i][j] == 'O') s ++;
		}
	}

	for(i=0; i<m; i++){
		for(j=n-1, s=0; j>=0; j--){
			if(S[j][i] == 'J') Y[j][i] = s;
			else if(S[j][i] == 'I') s ++;
		}
	}

	for(i=0; i<n; i++){
		for(j=0; j<m; j++){
			ans += X[i][j] * Y[i][j];
		}
	}

	printf("%lld\n", ans);

	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", S[i]);
   ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory 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 3 ms 1664 KB Output is correct
6 Correct 3 ms 1408 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1520 KB Output is correct
12 Correct 3 ms 1580 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
# Verdict Execution time Memory 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 3 ms 1664 KB Output is correct
6 Correct 3 ms 1408 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1520 KB Output is correct
12 Correct 3 ms 1580 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 12 ms 8832 KB Output is correct
15 Correct 5 ms 4736 KB Output is correct
16 Correct 6 ms 4352 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 13 ms 9856 KB Output is correct
19 Correct 10 ms 7936 KB Output is correct
20 Correct 9 ms 7040 KB Output is correct
21 Correct 12 ms 9856 KB Output is correct
22 Correct 10 ms 8444 KB Output is correct
23 Correct 8 ms 7088 KB Output is correct
24 Correct 13 ms 9820 KB Output is correct
25 Correct 9 ms 7936 KB Output is correct
26 Correct 9 ms 7044 KB Output is correct
# Verdict Execution time Memory 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 3 ms 1664 KB Output is correct
6 Correct 3 ms 1408 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1520 KB Output is correct
12 Correct 3 ms 1580 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 12 ms 8832 KB Output is correct
15 Correct 5 ms 4736 KB Output is correct
16 Correct 6 ms 4352 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 13 ms 9856 KB Output is correct
19 Correct 10 ms 7936 KB Output is correct
20 Correct 9 ms 7040 KB Output is correct
21 Correct 12 ms 9856 KB Output is correct
22 Correct 10 ms 8444 KB Output is correct
23 Correct 8 ms 7088 KB Output is correct
24 Correct 13 ms 9820 KB Output is correct
25 Correct 9 ms 7936 KB Output is correct
26 Correct 9 ms 7044 KB Output is correct
27 Correct 296 ms 151660 KB Output is correct
28 Correct 19 ms 24960 KB Output is correct
29 Correct 12 ms 7232 KB Output is correct
30 Correct 2 ms 768 KB Output is correct
31 Correct 223 ms 125648 KB Output is correct
32 Correct 184 ms 106356 KB Output is correct
33 Correct 213 ms 80444 KB Output is correct
34 Correct 272 ms 145868 KB Output is correct
35 Correct 278 ms 118328 KB Output is correct
36 Correct 236 ms 80672 KB Output is correct
37 Correct 350 ms 152544 KB Output is correct
38 Correct 137 ms 81688 KB Output is correct
39 Correct 147 ms 61244 KB Output is correct