Submission #670295

# Submission time Handle Problem Language Result Execution time Memory
670295 2022-12-08T15:41:03 Z dozer Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
305 ms 220888 KB
#include <bits/stdc++.h>
using namespace std;
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define pii pair<int, int>
#define st first
#define nd second
#define endl "\n"
#define sp " "
#define N 3005
#define int long long

int row[N][N], col[N][N], arr[N][N];


int32_t main()
{
	fastio();

	int h, w;
	cin>>h>>w;
	for (int i = 1; i <= h; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			char tmp;
			cin>>tmp;
			col[i][j] = col[i][j - 1];
			row[i][j] = row[i - 1][j];
			if (tmp == 'J') arr[i][j] = 1;
			else if (tmp == 'O') arr[i][j] = 2, col[i][j]++;
			else arr[i][j] = 3, row[i][j]++; 
			//cout<<row[i][j]<<sp;
		}
		//cout<<endl;
	}
	int ans = 0;
	for (int i = 1; i <= h; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			if (arr[i][j] == 1) ans += (row[h][j] - row[i][j]) * (col[i][w] - col[i][j]);
		}
	}
	cout<<ans<<endl;

	cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<" seconds\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1752 KB Output is correct
6 Correct 1 ms 1748 KB Output is correct
7 Correct 1 ms 1620 KB Output is correct
8 Correct 1 ms 1744 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1620 KB Output is correct
11 Correct 1 ms 1748 KB Output is correct
12 Correct 1 ms 1748 KB Output is correct
13 Correct 1 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1752 KB Output is correct
6 Correct 1 ms 1748 KB Output is correct
7 Correct 1 ms 1620 KB Output is correct
8 Correct 1 ms 1744 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1620 KB Output is correct
11 Correct 1 ms 1748 KB Output is correct
12 Correct 1 ms 1748 KB Output is correct
13 Correct 1 ms 1620 KB Output is correct
14 Correct 10 ms 10964 KB Output is correct
15 Correct 3 ms 5460 KB Output is correct
16 Correct 6 ms 6612 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 12 ms 12500 KB Output is correct
19 Correct 11 ms 12244 KB Output is correct
20 Correct 9 ms 12264 KB Output is correct
21 Correct 12 ms 12500 KB Output is correct
22 Correct 10 ms 12212 KB Output is correct
23 Correct 10 ms 12252 KB Output is correct
24 Correct 15 ms 12440 KB Output is correct
25 Correct 10 ms 12260 KB Output is correct
26 Correct 9 ms 12244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1752 KB Output is correct
6 Correct 1 ms 1748 KB Output is correct
7 Correct 1 ms 1620 KB Output is correct
8 Correct 1 ms 1744 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1620 KB Output is correct
11 Correct 1 ms 1748 KB Output is correct
12 Correct 1 ms 1748 KB Output is correct
13 Correct 1 ms 1620 KB Output is correct
14 Correct 10 ms 10964 KB Output is correct
15 Correct 3 ms 5460 KB Output is correct
16 Correct 6 ms 6612 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 12 ms 12500 KB Output is correct
19 Correct 11 ms 12244 KB Output is correct
20 Correct 9 ms 12264 KB Output is correct
21 Correct 12 ms 12500 KB Output is correct
22 Correct 10 ms 12212 KB Output is correct
23 Correct 10 ms 12252 KB Output is correct
24 Correct 15 ms 12440 KB Output is correct
25 Correct 10 ms 12260 KB Output is correct
26 Correct 9 ms 12244 KB Output is correct
27 Correct 289 ms 220216 KB Output is correct
28 Correct 14 ms 29084 KB Output is correct
29 Correct 19 ms 19156 KB Output is correct
30 Correct 1 ms 992 KB Output is correct
31 Correct 232 ms 182840 KB Output is correct
32 Correct 235 ms 220752 KB Output is correct
33 Correct 197 ms 220068 KB Output is correct
34 Correct 264 ms 211952 KB Output is correct
35 Correct 245 ms 220748 KB Output is correct
36 Correct 203 ms 219980 KB Output is correct
37 Correct 305 ms 220888 KB Output is correct
38 Correct 170 ms 181972 KB Output is correct
39 Correct 152 ms 182016 KB Output is correct