Submission #171988

# Submission time Handle Problem Language Result Execution time Memory
171988 2019-12-30T18:19:28 Z cheissmart Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
480 ms 88568 KB
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

char a[3003][3003];

int I[3003][3003], O[3003][3003];

signed main()
{
	IO_OP;
	
	int n, m;
	cin >> n >> m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin >> a[i][j];
	ll ans = 0;
	for(int i=1;i<=n;i++)
		for(int j=m;j>=1;j--)
			O[i][j] = O[i][j+1] + (a[i][j] == 'O');
	for(int j=1;j<=m;j++)
		for(int i=n;i>=1;i--)
			I[i][j] = I[i+1][j] + (a[i][j] == 'I');
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(a[i][j] == 'J')
				ans += O[i][j] * I[i][j];
	cout << ans << endl;
	
}



# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1456 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1456 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 13 ms 7544 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 8 ms 4344 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 15 ms 8056 KB Output is correct
19 Correct 14 ms 7928 KB Output is correct
20 Correct 14 ms 7900 KB Output is correct
21 Correct 15 ms 8056 KB Output is correct
22 Correct 14 ms 7928 KB Output is correct
23 Correct 14 ms 7928 KB Output is correct
24 Correct 16 ms 8056 KB Output is correct
25 Correct 14 ms 7928 KB Output is correct
26 Correct 14 ms 7852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1456 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 13 ms 7544 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 8 ms 4344 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 15 ms 8056 KB Output is correct
19 Correct 14 ms 7928 KB Output is correct
20 Correct 14 ms 7900 KB Output is correct
21 Correct 15 ms 8056 KB Output is correct
22 Correct 14 ms 7928 KB Output is correct
23 Correct 14 ms 7928 KB Output is correct
24 Correct 16 ms 8056 KB Output is correct
25 Correct 14 ms 7928 KB Output is correct
26 Correct 14 ms 7852 KB Output is correct
27 Correct 457 ms 88264 KB Output is correct
28 Correct 26 ms 26104 KB Output is correct
29 Correct 21 ms 7928 KB Output is correct
30 Correct 3 ms 632 KB Output is correct
31 Correct 335 ms 72776 KB Output is correct
32 Correct 438 ms 88540 KB Output is correct
33 Correct 436 ms 88320 KB Output is correct
34 Correct 420 ms 84180 KB Output is correct
35 Correct 441 ms 88568 KB Output is correct
36 Correct 441 ms 88304 KB Output is correct
37 Correct 480 ms 88568 KB Output is correct
38 Correct 310 ms 72516 KB Output is correct
39 Correct 317 ms 72312 KB Output is correct