Submission #110356

# Submission time Handle Problem Language Result Execution time Memory
110356 2019-05-10T18:00:16 Z pamaj Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
619 ms 150704 KB
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e3 + 10;

int_fast64_t numO[maxn][maxn], numI[maxn][maxn];

int main()
{
	ios::sync_with_stdio(false), cin.tie(nullptr);
	
	char tab[maxn][maxn];

	int H, W;

	cin >> H >> W;

	for(int i = 0; i < H; i++)
	{
		for(int j = 0; j < W; j++)
		{
			cin >> tab[i][j];
		}
	}

	for(int i = 0; i < H; i++)
	{
		for(int j = 1; j < W; j++)
		{
			if(j)numO[i][j] += numO[i][j - 1];
			if(tab[i][j] == 'O') numO[i][j]++;
		}
	}

	for(int i = 0; i < W; i++)
	{
		for(int j = 0; j < H; j++)
		{
			if(j) numI[j][i] += numI[j - 1][i];
			if(tab[j][i] == 'I') numI[j][i]++;
		}
	}

	//for(int i = 0; i < H; i++) cout << numO[i][W - 1] << " \n"[i== H-1];

	//for(int i = 0; i < W; i++) cout << numI[H - 1][i] << " \n"[i== W-1];
	
	int_fast64_t cont = 0;

	for(int i = 0; i < H; i++)
	{
		for(int j = 0; j < W; j++)
		{
				if(tab[i][j] == 'J')
				{
					//cout << i << " " << j << "\n";
					cont += (numO[i][W - 1] - numO[i][j])*(numI[H - 1][j] -numI[i][j]);
				}
		}
	}

	cout << cont << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 4 ms 512 KB Output is correct
5 Correct 4 ms 1664 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 4 ms 1536 KB Output is correct
8 Correct 4 ms 1792 KB Output is correct
9 Correct 5 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 5 ms 1536 KB Output is correct
12 Correct 4 ms 1664 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 4 ms 512 KB Output is correct
5 Correct 4 ms 1664 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 4 ms 1536 KB Output is correct
8 Correct 4 ms 1792 KB Output is correct
9 Correct 5 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 5 ms 1536 KB Output is correct
12 Correct 4 ms 1664 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 15 ms 8832 KB Output is correct
15 Correct 6 ms 5120 KB Output is correct
16 Correct 11 ms 5248 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 19 ms 9728 KB Output is correct
19 Correct 21 ms 9600 KB Output is correct
20 Correct 14 ms 9600 KB Output is correct
21 Correct 20 ms 9744 KB Output is correct
22 Correct 18 ms 9600 KB Output is correct
23 Correct 15 ms 9564 KB Output is correct
24 Correct 18 ms 9728 KB Output is correct
25 Correct 16 ms 9600 KB Output is correct
26 Correct 14 ms 9600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 4 ms 512 KB Output is correct
5 Correct 4 ms 1664 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 4 ms 1536 KB Output is correct
8 Correct 4 ms 1792 KB Output is correct
9 Correct 5 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 5 ms 1536 KB Output is correct
12 Correct 4 ms 1664 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 15 ms 8832 KB Output is correct
15 Correct 6 ms 5120 KB Output is correct
16 Correct 11 ms 5248 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 19 ms 9728 KB Output is correct
19 Correct 21 ms 9600 KB Output is correct
20 Correct 14 ms 9600 KB Output is correct
21 Correct 20 ms 9744 KB Output is correct
22 Correct 18 ms 9600 KB Output is correct
23 Correct 15 ms 9564 KB Output is correct
24 Correct 18 ms 9728 KB Output is correct
25 Correct 16 ms 9600 KB Output is correct
26 Correct 14 ms 9600 KB Output is correct
27 Correct 526 ms 150672 KB Output is correct
28 Correct 25 ms 26368 KB Output is correct
29 Correct 30 ms 13304 KB Output is correct
30 Correct 3 ms 768 KB Output is correct
31 Correct 418 ms 125688 KB Output is correct
32 Correct 494 ms 150656 KB Output is correct
33 Correct 546 ms 150136 KB Output is correct
34 Correct 489 ms 145528 KB Output is correct
35 Correct 525 ms 150704 KB Output is correct
36 Correct 537 ms 150264 KB Output is correct
37 Correct 619 ms 150648 KB Output is correct
38 Correct 399 ms 124836 KB Output is correct
39 Correct 364 ms 125024 KB Output is correct