Submission #136757

# Submission time Handle Problem Language Result Execution time Memory
136757 2019-07-26T08:16:12 Z Kewo Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
387 ms 79996 KB
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(3e3 + 5);
const int LOG = (int)(20);

int n, m, O[N][N], I[N][N];
char s[N][N];
lli ans;

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);
	
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
		cin >> s[i] + 1;
	for(int i = 1; i <= n; i++)
		for(int j = m; j >= 1; j--)
			O[i][j] = O[i][j + 1] + (s[i][j] == 'O');

	for(int i = 1; i <= m; i++)
		for(int j = n; j >= 1; j--)
			I[j][i] = I[j + 1][i] + (s[j][i] == 'I');

	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			if(s[i][j] == 'J')
				ans += O[i][j] * I[i][j];
	cout << ans;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:37:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   cin >> s[i] + 1;
          ~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 4 ms 1400 KB Output is correct
8 Correct 4 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 4 ms 1400 KB Output is correct
8 Correct 4 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 11 ms 7288 KB Output is correct
15 Correct 6 ms 5112 KB Output is correct
16 Correct 8 ms 4220 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 11 ms 7800 KB Output is correct
19 Correct 11 ms 7672 KB Output is correct
20 Correct 11 ms 7672 KB Output is correct
21 Correct 12 ms 7800 KB Output is correct
22 Correct 10 ms 7672 KB Output is correct
23 Correct 10 ms 7672 KB Output is correct
24 Correct 12 ms 7804 KB Output is correct
25 Correct 11 ms 7672 KB Output is correct
26 Correct 10 ms 7672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 4 ms 1400 KB Output is correct
8 Correct 4 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 11 ms 7288 KB Output is correct
15 Correct 6 ms 5112 KB Output is correct
16 Correct 8 ms 4220 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 11 ms 7800 KB Output is correct
19 Correct 11 ms 7672 KB Output is correct
20 Correct 11 ms 7672 KB Output is correct
21 Correct 12 ms 7800 KB Output is correct
22 Correct 10 ms 7672 KB Output is correct
23 Correct 10 ms 7672 KB Output is correct
24 Correct 12 ms 7804 KB Output is correct
25 Correct 11 ms 7672 KB Output is correct
26 Correct 10 ms 7672 KB Output is correct
27 Correct 354 ms 79916 KB Output is correct
28 Correct 26 ms 26104 KB Output is correct
29 Correct 13 ms 7288 KB Output is correct
30 Correct 2 ms 632 KB Output is correct
31 Correct 264 ms 66516 KB Output is correct
32 Correct 333 ms 79776 KB Output is correct
33 Correct 329 ms 79480 KB Output is correct
34 Correct 311 ms 77176 KB Output is correct
35 Correct 337 ms 79864 KB Output is correct
36 Correct 334 ms 79424 KB Output is correct
37 Correct 387 ms 79996 KB Output is correct
38 Correct 238 ms 66560 KB Output is correct
39 Correct 241 ms 66296 KB Output is correct