Submission #234099

# Submission time Handle Problem Language Result Execution time Memory
234099 2020-05-23T05:11:38 Z super_j6 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
153 ms 83576 KB
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second

const int maxn = 3001;
int n, m;
string s[maxn];
int a[maxn][maxn], b[maxn][maxn];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	
	for(int i = 0; i < n; i++){
	    cin >> s[i];
	    for(int j = 0; j < m; j++){
	        if(s[i][j] == 'O') a[i][j]++;
	        if(s[i][j] == 'I') b[i][j]++;
	    }
	}
	
	ll ret = 0;
	for(int i = n - 1; ~i; i--)
	for(int j = m - 1; ~j; j--){
	    a[i][j] += a[i][j + 1];
	    b[i][j] += b[i + 1][j];
	    ret += (s[i][j] == 'J') * a[i][j] * b[i][j];
	}
	
	cout << ret << endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 512 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 5 ms 1408 KB Output is correct
6 Correct 5 ms 1408 KB Output is correct
7 Correct 5 ms 1280 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 5 ms 1280 KB Output is correct
11 Correct 5 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 5 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 512 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 5 ms 1408 KB Output is correct
6 Correct 5 ms 1408 KB Output is correct
7 Correct 5 ms 1280 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 5 ms 1280 KB Output is correct
11 Correct 5 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 5 ms 1280 KB Output is correct
14 Correct 10 ms 6272 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 7 ms 3840 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 11 ms 6912 KB Output is correct
19 Correct 9 ms 6784 KB Output is correct
20 Correct 9 ms 6784 KB Output is correct
21 Correct 11 ms 6912 KB Output is correct
22 Correct 9 ms 6784 KB Output is correct
23 Correct 9 ms 6784 KB Output is correct
24 Correct 11 ms 6912 KB Output is correct
25 Correct 9 ms 6784 KB Output is correct
26 Correct 9 ms 6784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 512 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 5 ms 1408 KB Output is correct
6 Correct 5 ms 1408 KB Output is correct
7 Correct 5 ms 1280 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 5 ms 1280 KB Output is correct
11 Correct 5 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 5 ms 1280 KB Output is correct
14 Correct 10 ms 6272 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 7 ms 3840 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 11 ms 6912 KB Output is correct
19 Correct 9 ms 6784 KB Output is correct
20 Correct 9 ms 6784 KB Output is correct
21 Correct 11 ms 6912 KB Output is correct
22 Correct 9 ms 6784 KB Output is correct
23 Correct 9 ms 6784 KB Output is correct
24 Correct 11 ms 6912 KB Output is correct
25 Correct 9 ms 6784 KB Output is correct
26 Correct 9 ms 6784 KB Output is correct
27 Correct 144 ms 82648 KB Output is correct
28 Correct 15 ms 19328 KB Output is correct
29 Correct 13 ms 7808 KB Output is correct
30 Correct 5 ms 768 KB Output is correct
31 Correct 110 ms 68344 KB Output is correct
32 Correct 118 ms 83448 KB Output is correct
33 Correct 100 ms 83320 KB Output is correct
34 Correct 128 ms 78840 KB Output is correct
35 Correct 105 ms 83448 KB Output is correct
36 Correct 98 ms 83320 KB Output is correct
37 Correct 153 ms 83576 KB Output is correct
38 Correct 79 ms 68344 KB Output is correct
39 Correct 76 ms 68092 KB Output is correct