답안 #234828

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
234828 2020-05-25T20:04:52 Z davitmarg Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
249 ms 159124 KB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
#define fastIO ios::sync_with_stdio(false); cin.tie(0)
using namespace std;

const int N = 3005;

int n, m;
char a[N][N];
LL ans = 0, O[N][N], I[N][N];
int main()
{
	fastIO;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			cin >> a[i][j];
	for (int i = n; i >= 1; i--)
		for (int j = m; j >= 1; j--)
		{
			O[i][j] = O[i][j + 1];
			I[i][j] = I[i + 1][j];
			if (a[i][j] == 'O')
				O[i][j]++;
			if (a[i][j] == 'I')
				I[i][j]++;
			if (a[i][j] == 'J')
				ans += O[i][j] * I[i][j];
		}
	cout << ans << endl;
	return 0;
}

/*



*/
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 5 ms 1664 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 6 ms 1536 KB Output is correct
8 Correct 5 ms 1664 KB Output is correct
9 Correct 5 ms 1536 KB Output is correct
10 Correct 5 ms 1536 KB Output is correct
11 Correct 5 ms 1664 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 5 ms 1664 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 6 ms 1536 KB Output is correct
8 Correct 5 ms 1664 KB Output is correct
9 Correct 5 ms 1536 KB Output is correct
10 Correct 5 ms 1536 KB Output is correct
11 Correct 5 ms 1664 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1536 KB Output is correct
14 Correct 12 ms 9088 KB Output is correct
15 Correct 7 ms 5120 KB Output is correct
16 Correct 9 ms 5376 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 14 ms 9984 KB Output is correct
19 Correct 13 ms 9856 KB Output is correct
20 Correct 13 ms 9856 KB Output is correct
21 Correct 15 ms 9984 KB Output is correct
22 Correct 13 ms 9856 KB Output is correct
23 Correct 13 ms 9856 KB Output is correct
24 Correct 14 ms 9984 KB Output is correct
25 Correct 13 ms 9856 KB Output is correct
26 Correct 13 ms 9856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 5 ms 1664 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 6 ms 1536 KB Output is correct
8 Correct 5 ms 1664 KB Output is correct
9 Correct 5 ms 1536 KB Output is correct
10 Correct 5 ms 1536 KB Output is correct
11 Correct 5 ms 1664 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1536 KB Output is correct
14 Correct 12 ms 9088 KB Output is correct
15 Correct 7 ms 5120 KB Output is correct
16 Correct 9 ms 5376 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 14 ms 9984 KB Output is correct
19 Correct 13 ms 9856 KB Output is correct
20 Correct 13 ms 9856 KB Output is correct
21 Correct 15 ms 9984 KB Output is correct
22 Correct 13 ms 9856 KB Output is correct
23 Correct 13 ms 9856 KB Output is correct
24 Correct 14 ms 9984 KB Output is correct
25 Correct 13 ms 9856 KB Output is correct
26 Correct 13 ms 9856 KB Output is correct
27 Correct 244 ms 158588 KB Output is correct
28 Correct 18 ms 26368 KB Output is correct
29 Correct 24 ms 13952 KB Output is correct
30 Correct 5 ms 896 KB Output is correct
31 Correct 183 ms 131448 KB Output is correct
32 Correct 206 ms 159064 KB Output is correct
33 Correct 207 ms 158588 KB Output is correct
34 Correct 211 ms 152440 KB Output is correct
35 Correct 203 ms 159124 KB Output is correct
36 Correct 213 ms 158584 KB Output is correct
37 Correct 249 ms 159096 KB Output is correct
38 Correct 160 ms 130808 KB Output is correct
39 Correct 154 ms 130872 KB Output is correct