Submission #99091

# Submission time Handle Problem Language Result Execution time Memory
99091 2019-02-28T14:12:46 Z gs14004 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
250 ms 83016 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3005;
using lint = long long;
 
int n, m;
char str[MAXN][MAXN];
int OS[MAXN][MAXN];
int IS[MAXN][MAXN];
 
int main(){
	scanf("%d %d",&n,&m);
	for(int i=1; i<=n; i++){
		scanf("%s", str[i] + 1);
		for(int j=1; j<=m; j++){
			if(str[i][j] == 'O') OS[i][j]++;
			if(str[i][j] == 'I') IS[i][j]++;
		}
	}
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			OS[i][j] += OS[i][j-1];
			IS[i][j] += IS[i-1][j];
		}
	}
	lint ret = 0;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(str[i][j] == 'J'){
				ret += (OS[i][m] - OS[i][j]) * (IS[n][j] - IS[i][j]);
			}
		}
	}
	cout << ret << endl;
}
 

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:12: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:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", str[i] + 1);
   ~~~~~^~~~~~~~~~~~~~~~~~
# 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 320 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1480 KB Output is correct
6 Correct 4 ms 1544 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1580 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 3 ms 1536 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 320 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1480 KB Output is correct
6 Correct 4 ms 1544 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1580 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 10 ms 7424 KB Output is correct
15 Correct 7 ms 4964 KB Output is correct
16 Correct 7 ms 4224 KB Output is correct
17 Correct 2 ms 556 KB Output is correct
18 Correct 14 ms 8092 KB Output is correct
19 Correct 13 ms 7936 KB Output is correct
20 Correct 11 ms 7808 KB Output is correct
21 Correct 13 ms 7936 KB Output is correct
22 Correct 11 ms 7936 KB Output is correct
23 Correct 10 ms 7808 KB Output is correct
24 Correct 12 ms 7936 KB Output is correct
25 Correct 12 ms 7928 KB Output is correct
26 Correct 11 ms 7808 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 320 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1480 KB Output is correct
6 Correct 4 ms 1544 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1580 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 10 ms 7424 KB Output is correct
15 Correct 7 ms 4964 KB Output is correct
16 Correct 7 ms 4224 KB Output is correct
17 Correct 2 ms 556 KB Output is correct
18 Correct 14 ms 8092 KB Output is correct
19 Correct 13 ms 7936 KB Output is correct
20 Correct 11 ms 7808 KB Output is correct
21 Correct 13 ms 7936 KB Output is correct
22 Correct 11 ms 7936 KB Output is correct
23 Correct 10 ms 7808 KB Output is correct
24 Correct 12 ms 7936 KB Output is correct
25 Correct 12 ms 7928 KB Output is correct
26 Correct 11 ms 7808 KB Output is correct
27 Correct 231 ms 82848 KB Output is correct
28 Correct 24 ms 25976 KB Output is correct
29 Correct 14 ms 7780 KB Output is correct
30 Correct 2 ms 640 KB Output is correct
31 Correct 181 ms 69820 KB Output is correct
32 Correct 150 ms 83004 KB Output is correct
33 Correct 129 ms 82840 KB Output is correct
34 Correct 206 ms 80512 KB Output is correct
35 Correct 153 ms 82936 KB Output is correct
36 Correct 154 ms 82728 KB Output is correct
37 Correct 250 ms 83016 KB Output is correct
38 Correct 115 ms 69752 KB Output is correct
39 Correct 109 ms 69496 KB Output is correct