Submission #913599

# Submission time Handle Problem Language Result Execution time Memory
913599 2024-01-20T08:29:35 Z __newbie__ Bitaro the Brave (JOI19_ho_t1) C++11
50 / 100
343 ms 274432 KB
#include <bits/stdc++.h>

#define pb push_back
#define int ll
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
int N = 3e3 + 20;

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;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:47:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   47 |  for (auto [i, j] : J)
      |            ^
# Verdict Execution time Memory Grader output
1 Correct 105 ms 214964 KB Output is correct
2 Correct 111 ms 214952 KB Output is correct
3 Correct 105 ms 214868 KB Output is correct
4 Correct 103 ms 214816 KB Output is correct
5 Correct 106 ms 215140 KB Output is correct
6 Correct 100 ms 214904 KB Output is correct
7 Correct 104 ms 215048 KB Output is correct
8 Correct 109 ms 215164 KB Output is correct
9 Correct 107 ms 214972 KB Output is correct
10 Correct 118 ms 215064 KB Output is correct
11 Correct 106 ms 215132 KB Output is correct
12 Correct 98 ms 214872 KB Output is correct
13 Correct 103 ms 214928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 105 ms 214964 KB Output is correct
2 Correct 111 ms 214952 KB Output is correct
3 Correct 105 ms 214868 KB Output is correct
4 Correct 103 ms 214816 KB Output is correct
5 Correct 106 ms 215140 KB Output is correct
6 Correct 100 ms 214904 KB Output is correct
7 Correct 104 ms 215048 KB Output is correct
8 Correct 109 ms 215164 KB Output is correct
9 Correct 107 ms 214972 KB Output is correct
10 Correct 118 ms 215064 KB Output is correct
11 Correct 106 ms 215132 KB Output is correct
12 Correct 98 ms 214872 KB Output is correct
13 Correct 103 ms 214928 KB Output is correct
14 Correct 109 ms 216564 KB Output is correct
15 Correct 104 ms 214868 KB Output is correct
16 Correct 110 ms 216724 KB Output is correct
17 Correct 106 ms 215008 KB Output is correct
18 Correct 118 ms 216752 KB Output is correct
19 Correct 121 ms 215320 KB Output is correct
20 Correct 121 ms 216456 KB Output is correct
21 Correct 112 ms 216488 KB Output is correct
22 Correct 122 ms 216612 KB Output is correct
23 Correct 121 ms 216612 KB Output is correct
24 Correct 120 ms 219472 KB Output is correct
25 Correct 114 ms 215696 KB Output is correct
26 Correct 111 ms 216488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 105 ms 214964 KB Output is correct
2 Correct 111 ms 214952 KB Output is correct
3 Correct 105 ms 214868 KB Output is correct
4 Correct 103 ms 214816 KB Output is correct
5 Correct 106 ms 215140 KB Output is correct
6 Correct 100 ms 214904 KB Output is correct
7 Correct 104 ms 215048 KB Output is correct
8 Correct 109 ms 215164 KB Output is correct
9 Correct 107 ms 214972 KB Output is correct
10 Correct 118 ms 215064 KB Output is correct
11 Correct 106 ms 215132 KB Output is correct
12 Correct 98 ms 214872 KB Output is correct
13 Correct 103 ms 214928 KB Output is correct
14 Correct 109 ms 216564 KB Output is correct
15 Correct 104 ms 214868 KB Output is correct
16 Correct 110 ms 216724 KB Output is correct
17 Correct 106 ms 215008 KB Output is correct
18 Correct 118 ms 216752 KB Output is correct
19 Correct 121 ms 215320 KB Output is correct
20 Correct 121 ms 216456 KB Output is correct
21 Correct 112 ms 216488 KB Output is correct
22 Correct 122 ms 216612 KB Output is correct
23 Correct 121 ms 216612 KB Output is correct
24 Correct 120 ms 219472 KB Output is correct
25 Correct 114 ms 215696 KB Output is correct
26 Correct 111 ms 216488 KB Output is correct
27 Correct 343 ms 264332 KB Output is correct
28 Correct 113 ms 215376 KB Output is correct
29 Correct 131 ms 221924 KB Output is correct
30 Correct 102 ms 215120 KB Output is correct
31 Correct 293 ms 264352 KB Output is correct
32 Correct 299 ms 239344 KB Output is correct
33 Correct 324 ms 265264 KB Output is correct
34 Correct 291 ms 263812 KB Output is correct
35 Correct 317 ms 264104 KB Output is correct
36 Correct 342 ms 265184 KB Output is correct
37 Runtime error 291 ms 274432 KB Execution killed with signal 9
38 Halted 0 ms 0 KB -