답안 #234091

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
234091 2020-05-23T01:28:26 Z eggag32 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
96 ms 18432 KB
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i, h) cin >> s[i];
	ll ans = 0;
	vector<ll> cnt(h, 0), cnt1(w, 0);
	for(int i = h - 1; i >= 0; i--){
		for(int j = w - 1; j >= 0; j--){
			if(s[i][j] == 'O') cnt[i]++;
			if(s[i][j] == 'I') cnt1[j]++;
			if(s[i][j] == 'J') ans += (ll)(cnt[i] * cnt1[j]);
		}
	}
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 7 ms 768 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 640 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 7 ms 896 KB Output is correct
19 Correct 6 ms 820 KB Output is correct
20 Correct 6 ms 896 KB Output is correct
21 Correct 7 ms 896 KB Output is correct
22 Correct 6 ms 896 KB Output is correct
23 Correct 6 ms 1024 KB Output is correct
24 Correct 7 ms 896 KB Output is correct
25 Correct 6 ms 896 KB Output is correct
26 Correct 6 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 7 ms 768 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 640 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 7 ms 896 KB Output is correct
19 Correct 6 ms 820 KB Output is correct
20 Correct 6 ms 896 KB Output is correct
21 Correct 7 ms 896 KB Output is correct
22 Correct 6 ms 896 KB Output is correct
23 Correct 6 ms 1024 KB Output is correct
24 Correct 7 ms 896 KB Output is correct
25 Correct 6 ms 896 KB Output is correct
26 Correct 6 ms 896 KB Output is correct
27 Correct 92 ms 17912 KB Output is correct
28 Correct 5 ms 512 KB Output is correct
29 Correct 8 ms 1664 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 73 ms 13184 KB Output is correct
32 Correct 63 ms 18424 KB Output is correct
33 Correct 39 ms 18432 KB Output is correct
34 Correct 80 ms 15232 KB Output is correct
35 Correct 54 ms 18432 KB Output is correct
36 Correct 38 ms 18432 KB Output is correct
37 Correct 96 ms 18432 KB Output is correct
38 Correct 40 ms 13056 KB Output is correct
39 Correct 29 ms 13184 KB Output is correct