Submission #786769

# Submission time Handle Problem Language Result Execution time Memory
786769 2023-07-18T12:41:38 Z winter0101 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
302 ms 115116 KB
#include <bits/stdc++.h>
using namespace std;
int a[3009][3009];
int b[3009][3009];
int c[3009][3009];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen(".INP","r",stdin);
   // freopen(".OUT","w",stdout);
	int n,m;
	cin>>n>>m;
	for (int i=1;i<=n;i++){
		string s;
		cin>>s;
		for (int j=1;j<=m;j++){
			if (s[j-1]=='J')a[i][j]=1;
			else if (s[j-1]=='O')a[i][j]=2;
			else a[i][j]=3;
		}
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			b[i][j]=b[i][j-1];
			if (a[i][j]==2)b[i][j]++;
		}
	}
	for (int j=1;j<=m;j++){
		for (int i=1;i<=n;i++){
			c[i][j]=c[i-1][j];
			if (a[i][j]==3)c[i][j]++;
		}
	}
	long long ans=0;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			if (a[i][j]==1)ans=ans+(b[i][m]-b[i][j])*(c[n][j]-c[i][j]);
		}
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1620 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1620 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 1612 KB Output is correct
13 Correct 1 ms 1488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1620 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1620 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 1612 KB Output is correct
13 Correct 1 ms 1488 KB Output is correct
14 Correct 7 ms 8708 KB Output is correct
15 Correct 2 ms 5460 KB Output is correct
16 Correct 3 ms 5096 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 8 ms 9508 KB Output is correct
19 Correct 6 ms 9428 KB Output is correct
20 Correct 6 ms 9300 KB Output is correct
21 Correct 11 ms 9488 KB Output is correct
22 Correct 5 ms 9428 KB Output is correct
23 Correct 6 ms 9300 KB Output is correct
24 Correct 9 ms 9544 KB Output is correct
25 Correct 6 ms 9324 KB Output is correct
26 Correct 6 ms 9300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1620 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1620 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 1612 KB Output is correct
13 Correct 1 ms 1488 KB Output is correct
14 Correct 7 ms 8708 KB Output is correct
15 Correct 2 ms 5460 KB Output is correct
16 Correct 3 ms 5096 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 8 ms 9508 KB Output is correct
19 Correct 6 ms 9428 KB Output is correct
20 Correct 6 ms 9300 KB Output is correct
21 Correct 11 ms 9488 KB Output is correct
22 Correct 5 ms 9428 KB Output is correct
23 Correct 6 ms 9300 KB Output is correct
24 Correct 9 ms 9544 KB Output is correct
25 Correct 6 ms 9324 KB Output is correct
26 Correct 6 ms 9300 KB Output is correct
27 Correct 302 ms 114696 KB Output is correct
28 Correct 12 ms 28628 KB Output is correct
29 Correct 9 ms 10104 KB Output is correct
30 Correct 1 ms 596 KB Output is correct
31 Correct 222 ms 94796 KB Output is correct
32 Correct 235 ms 115088 KB Output is correct
33 Correct 222 ms 114744 KB Output is correct
34 Correct 254 ms 109896 KB Output is correct
35 Correct 227 ms 114988 KB Output is correct
36 Correct 220 ms 114792 KB Output is correct
37 Correct 302 ms 115116 KB Output is correct
38 Correct 149 ms 94736 KB Output is correct
39 Correct 152 ms 94412 KB Output is correct