Submission #319507

# Submission time Handle Problem Language Result Execution time Memory
319507 2020-11-05T12:52:32 Z mariowong Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
398 ms 159204 KB
#include <bits/stdc++.h>
#define x first
#define y second
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define pbb pair<bool,bool>
#define mp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define xmod (ll)(1e9+9) 
#define hmod 1286031825167LL
using namespace std;

ll ans,n,m,ps_o[3005][3005],ps_i[3005][3005];
char s[3005][3005];
int main(){	
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			cin >> s[i][j];
			ps_o[i][j]=ps_o[i][j-1];
			ps_i[i][j]=ps_i[i-1][j];
			if (s[i][j] == 'O')
			ps_o[i][j]++;
			if (s[i][j] == 'I')
			ps_i[i][j]++;
		}
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			if (s[i][j] == 'J')
			ans+=(ps_o[i][m]-ps_o[i][j])*(ps_i[n][j]-ps_i[i][j]);
		}
	}
	cout << ans << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 2 ms 1644 KB Output is correct
6 Correct 2 ms 1644 KB Output is correct
7 Correct 2 ms 1516 KB Output is correct
8 Correct 2 ms 1644 KB Output is correct
9 Correct 2 ms 1644 KB Output is correct
10 Correct 1 ms 1516 KB Output is correct
11 Correct 2 ms 1644 KB Output is correct
12 Correct 1 ms 1644 KB Output is correct
13 Correct 1 ms 1516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 2 ms 1644 KB Output is correct
6 Correct 2 ms 1644 KB Output is correct
7 Correct 2 ms 1516 KB Output is correct
8 Correct 2 ms 1644 KB Output is correct
9 Correct 2 ms 1644 KB Output is correct
10 Correct 1 ms 1516 KB Output is correct
11 Correct 2 ms 1644 KB Output is correct
12 Correct 1 ms 1644 KB Output is correct
13 Correct 1 ms 1516 KB Output is correct
14 Correct 12 ms 9088 KB Output is correct
15 Correct 4 ms 5100 KB Output is correct
16 Correct 7 ms 5356 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 15 ms 9964 KB Output is correct
19 Correct 12 ms 9836 KB Output is correct
20 Correct 14 ms 9836 KB Output is correct
21 Correct 15 ms 9964 KB Output is correct
22 Correct 13 ms 9836 KB Output is correct
23 Correct 12 ms 9836 KB Output is correct
24 Correct 15 ms 9984 KB Output is correct
25 Correct 12 ms 9836 KB Output is correct
26 Correct 12 ms 9868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 2 ms 1644 KB Output is correct
6 Correct 2 ms 1644 KB Output is correct
7 Correct 2 ms 1516 KB Output is correct
8 Correct 2 ms 1644 KB Output is correct
9 Correct 2 ms 1644 KB Output is correct
10 Correct 1 ms 1516 KB Output is correct
11 Correct 2 ms 1644 KB Output is correct
12 Correct 1 ms 1644 KB Output is correct
13 Correct 1 ms 1516 KB Output is correct
14 Correct 12 ms 9088 KB Output is correct
15 Correct 4 ms 5100 KB Output is correct
16 Correct 7 ms 5356 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 15 ms 9964 KB Output is correct
19 Correct 12 ms 9836 KB Output is correct
20 Correct 14 ms 9836 KB Output is correct
21 Correct 15 ms 9964 KB Output is correct
22 Correct 13 ms 9836 KB Output is correct
23 Correct 12 ms 9836 KB Output is correct
24 Correct 15 ms 9984 KB Output is correct
25 Correct 12 ms 9836 KB Output is correct
26 Correct 12 ms 9868 KB Output is correct
27 Correct 380 ms 158708 KB Output is correct
28 Correct 17 ms 26348 KB Output is correct
29 Correct 23 ms 13932 KB Output is correct
30 Correct 2 ms 876 KB Output is correct
31 Correct 290 ms 131428 KB Output is correct
32 Correct 320 ms 159140 KB Output is correct
33 Correct 293 ms 158568 KB Output is correct
34 Correct 333 ms 152420 KB Output is correct
35 Correct 337 ms 159204 KB Output is correct
36 Correct 294 ms 158568 KB Output is correct
37 Correct 398 ms 159204 KB Output is correct
38 Correct 229 ms 130788 KB Output is correct
39 Correct 212 ms 130916 KB Output is correct