Submission #231794

# Submission time Handle Problem Language Result Execution time Memory
231794 2020-05-14T19:19:11 Z peijar Bitaro the Brave (JOI19_ho_t1) C++17
20 / 100
13 ms 8064 KB
#include <bits/stdc++.h>
using namespace std;

#define SZ(v) ((int)(v).size())
using ll = long long;

const int MAXDIM = 3001;
char grid[MAXDIM][MAXDIM];
int suffix_row[MAXDIM][MAXDIM];
int suffix_col[MAXDIM][MAXDIM];

int main(void)
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int nb_lig, nb_col;
	cin >> nb_lig >> nb_col;
	for (int lig(0); lig < nb_lig; ++lig)
		for (int col(0); col < nb_col; ++col)	
			cin >> grid[lig][col];

	for (int lig(nb_lig-1); lig >= 0; --lig)
		for (int col(nb_col-1); col >= 0; --col)
		{
			suffix_row[lig][col] = suffix_row[lig][col+1] + (grid[lig][col] == 'O');
			suffix_col[lig][col] = suffix_col[lig+1][col] + (grid[lig][col] == 'I');
		}
	int ans(0);
	for (int lig(0); lig < nb_lig; ++lig)
		for (int col(0); col < nb_col; ++col)
			if (grid[lig][col] == 'J')
				ans += suffix_row[lig][col] * suffix_col[lig][col];
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 5 ms 1536 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 5 ms 1408 KB Output is correct
8 Correct 5 ms 1536 KB Output is correct
9 Correct 5 ms 1536 KB Output is correct
10 Correct 5 ms 1408 KB Output is correct
11 Correct 5 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 5 ms 1536 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 5 ms 1408 KB Output is correct
8 Correct 5 ms 1536 KB Output is correct
9 Correct 5 ms 1536 KB Output is correct
10 Correct 5 ms 1408 KB Output is correct
11 Correct 5 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1408 KB Output is correct
14 Correct 12 ms 7552 KB Output is correct
15 Correct 7 ms 4992 KB Output is correct
16 Correct 8 ms 4352 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 13 ms 8064 KB Output is correct
19 Correct 12 ms 7936 KB Output is correct
20 Incorrect 12 ms 8064 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 5 ms 1536 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 5 ms 1408 KB Output is correct
8 Correct 5 ms 1536 KB Output is correct
9 Correct 5 ms 1536 KB Output is correct
10 Correct 5 ms 1408 KB Output is correct
11 Correct 5 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1408 KB Output is correct
14 Correct 12 ms 7552 KB Output is correct
15 Correct 7 ms 4992 KB Output is correct
16 Correct 8 ms 4352 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 13 ms 8064 KB Output is correct
19 Correct 12 ms 7936 KB Output is correct
20 Incorrect 12 ms 8064 KB Output isn't correct
21 Halted 0 ms 0 KB -