Submission #316324

# Submission time Handle Problem Language Result Execution time Memory
316324 2020-10-25T21:00:21 Z aZvezda Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
170 ms 160376 KB
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) { out << x.first << " " << x.second; return out;}
template<class T, class T2> inline istream &operator >>(istream &in, pair<T, T2> &x) { in >> x.first >> x.second; return in;}
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
#define out(x) "{" << (#x) << ": " << x << "} "

const ll MAX_N = 3e3 + 10;
ll cnto[MAX_N][MAX_N], cnti[MAX_N][MAX_N];
string in[MAX_N];
ll n, m;

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	cin >> n >> m;
	for(ll i = 0; i < n; i ++) {
		cin >> in[i];
	}	
	ll ans = 0;
	for(ll i = n - 1; i >= 0; i --) {
		for(ll j = m - 1; j >= 0; j --) {
			cnto[i][j] = cnto[i][j + 1];
			cnti[i][j] = cnti[i + 1][j];
			if(in[i][j] == 'O') {
				cnto[i][j] ++;
			} else if(in[i][j] == 'I') {
				cnti[i][j] ++;
			} else {
				ans += cnto[i][j] * cnti[i][j];
			}
		}
	}
	cout << ans << endl;
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1408 KB Output is correct
6 Correct 1 ms 1408 KB Output is correct
7 Correct 1 ms 1280 KB Output is correct
8 Correct 1 ms 1408 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 1 ms 1280 KB Output is correct
11 Correct 1 ms 1408 KB Output is correct
12 Correct 1 ms 1408 KB Output is correct
13 Correct 1 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1408 KB Output is correct
6 Correct 1 ms 1408 KB Output is correct
7 Correct 1 ms 1280 KB Output is correct
8 Correct 1 ms 1408 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 1 ms 1280 KB Output is correct
11 Correct 1 ms 1408 KB Output is correct
12 Correct 1 ms 1408 KB Output is correct
13 Correct 1 ms 1280 KB Output is correct
14 Correct 7 ms 7808 KB Output is correct
15 Correct 3 ms 3968 KB Output is correct
16 Correct 4 ms 4860 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 8 ms 8832 KB Output is correct
19 Correct 6 ms 8704 KB Output is correct
20 Correct 6 ms 8704 KB Output is correct
21 Correct 8 ms 8832 KB Output is correct
22 Correct 6 ms 8704 KB Output is correct
23 Correct 7 ms 8704 KB Output is correct
24 Correct 9 ms 8832 KB Output is correct
25 Correct 6 ms 8704 KB Output is correct
26 Correct 6 ms 8704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1408 KB Output is correct
6 Correct 1 ms 1408 KB Output is correct
7 Correct 1 ms 1280 KB Output is correct
8 Correct 1 ms 1408 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 1 ms 1280 KB Output is correct
11 Correct 1 ms 1408 KB Output is correct
12 Correct 1 ms 1408 KB Output is correct
13 Correct 1 ms 1280 KB Output is correct
14 Correct 7 ms 7808 KB Output is correct
15 Correct 3 ms 3968 KB Output is correct
16 Correct 4 ms 4860 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 8 ms 8832 KB Output is correct
19 Correct 6 ms 8704 KB Output is correct
20 Correct 6 ms 8704 KB Output is correct
21 Correct 8 ms 8832 KB Output is correct
22 Correct 6 ms 8704 KB Output is correct
23 Correct 7 ms 8704 KB Output is correct
24 Correct 9 ms 8832 KB Output is correct
25 Correct 6 ms 8704 KB Output is correct
26 Correct 6 ms 8704 KB Output is correct
27 Correct 170 ms 159328 KB Output is correct
28 Correct 13 ms 19584 KB Output is correct
29 Correct 10 ms 13952 KB Output is correct
30 Correct 1 ms 896 KB Output is correct
31 Correct 129 ms 130936 KB Output is correct
32 Correct 123 ms 160248 KB Output is correct
33 Correct 123 ms 159736 KB Output is correct
34 Correct 150 ms 151928 KB Output is correct
35 Correct 123 ms 160120 KB Output is correct
36 Correct 121 ms 159736 KB Output is correct
37 Correct 166 ms 160376 KB Output is correct
38 Correct 97 ms 130168 KB Output is correct
39 Correct 95 ms 130424 KB Output is correct