Submission #913489

# Submission time Handle Problem Language Result Execution time Memory
913489 2024-01-20T08:07:12 Z __newbie__ Bitaro the Brave (JOI19_ho_t1) C++17
20 / 100
62 ms 107876 KB
#include <bits/stdc++.h>

#define pb push_back
using namespace std;

int N  = 3e3 + 7;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

signed main()
{
	int h, w; cin >> h >> w;
	
	vii a(N, vi(N)), b(N, vi(N));
	
	vpii J(N);
	
	vii gr(N, vi(N));
	
	for (int i = 1; i <= h; i++)
	{
		string s; cin >> s; 
		s = "$" + s;
		
		for (int j = 1; j <= w; j++)
		{
			gr[i][j] = s[j];
			if (s[j] == 'J') J.pb({i, j});	
		}
	}
	
	for (int i = h; i >= 1; i--)
	{
		for (int j = w; j >= 1; j--)
		{
			a[i][j] = a[i][j + 1] + (gr[i][j] == 'O');	
			b[i][j] = b[i + 1][j] + (gr[i][j] == 'I');
		}
	}
	
	int ans = 0;
	
	for (auto [i, j] : J)
	{
		ans += a[i][j] * b[i][j];
	}
	
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 53 ms 106952 KB Output is correct
2 Correct 49 ms 106996 KB Output is correct
3 Correct 51 ms 106968 KB Output is correct
4 Correct 52 ms 106968 KB Output is correct
5 Correct 50 ms 106960 KB Output is correct
6 Correct 54 ms 106960 KB Output is correct
7 Correct 47 ms 107092 KB Output is correct
8 Correct 56 ms 107000 KB Output is correct
9 Correct 50 ms 106832 KB Output is correct
10 Correct 48 ms 106880 KB Output is correct
11 Correct 46 ms 107100 KB Output is correct
12 Correct 50 ms 106820 KB Output is correct
13 Correct 51 ms 106948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 106952 KB Output is correct
2 Correct 49 ms 106996 KB Output is correct
3 Correct 51 ms 106968 KB Output is correct
4 Correct 52 ms 106968 KB Output is correct
5 Correct 50 ms 106960 KB Output is correct
6 Correct 54 ms 106960 KB Output is correct
7 Correct 47 ms 107092 KB Output is correct
8 Correct 56 ms 107000 KB Output is correct
9 Correct 50 ms 106832 KB Output is correct
10 Correct 48 ms 106880 KB Output is correct
11 Correct 46 ms 107100 KB Output is correct
12 Correct 50 ms 106820 KB Output is correct
13 Correct 51 ms 106948 KB Output is correct
14 Correct 51 ms 107876 KB Output is correct
15 Correct 56 ms 106836 KB Output is correct
16 Correct 53 ms 107652 KB Output is correct
17 Correct 55 ms 106996 KB Output is correct
18 Correct 55 ms 107860 KB Output is correct
19 Correct 62 ms 107520 KB Output is correct
20 Incorrect 56 ms 107776 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 53 ms 106952 KB Output is correct
2 Correct 49 ms 106996 KB Output is correct
3 Correct 51 ms 106968 KB Output is correct
4 Correct 52 ms 106968 KB Output is correct
5 Correct 50 ms 106960 KB Output is correct
6 Correct 54 ms 106960 KB Output is correct
7 Correct 47 ms 107092 KB Output is correct
8 Correct 56 ms 107000 KB Output is correct
9 Correct 50 ms 106832 KB Output is correct
10 Correct 48 ms 106880 KB Output is correct
11 Correct 46 ms 107100 KB Output is correct
12 Correct 50 ms 106820 KB Output is correct
13 Correct 51 ms 106948 KB Output is correct
14 Correct 51 ms 107876 KB Output is correct
15 Correct 56 ms 106836 KB Output is correct
16 Correct 53 ms 107652 KB Output is correct
17 Correct 55 ms 106996 KB Output is correct
18 Correct 55 ms 107860 KB Output is correct
19 Correct 62 ms 107520 KB Output is correct
20 Incorrect 56 ms 107776 KB Output isn't correct
21 Halted 0 ms 0 KB -