Submission #896811

# Submission time Handle Problem Language Result Execution time Memory
896811 2024-01-02T08:10:56 Z oblantis Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
143 ms 54192 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
const ll inf = 1e18 + 10000;
const int mod = 1e9+7;
const int maxn = 2e5 + 12;
void solve() {
	int n, m;
	cin >> n >> m;
	string s[n];
	int cnt[n][m + 1];
	for(int i = 0; i < n; i++) {
		cin >> s[i];
		cnt[i][m] = 0;
		for(int j = m - 1; j >= 0; j--){
			cnt[i][j] = cnt[i][j + 1];
			if(s[i][j] == 'O')cnt[i][j]++;
		}
	}
	ll ans = 0;
	for(int j = 0; j < m; j++){
		int I = 0;
		for(int i = n - 1; i >= 0; i--){
			if(s[i][j] == 'J')ans += cnt[i][j] * I;
			if(s[i][j] == 'I')I++;
		}
	}
	cout << ans;
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int times = 1;
	//cin >> times;
	for(int i = 1; i <= times; i++) {
		solve();
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 3 ms 1372 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 3 ms 1884 KB Output is correct
19 Correct 2 ms 1672 KB Output is correct
20 Correct 2 ms 1884 KB Output is correct
21 Correct 3 ms 1880 KB Output is correct
22 Correct 2 ms 1880 KB Output is correct
23 Correct 2 ms 1880 KB Output is correct
24 Correct 4 ms 1880 KB Output is correct
25 Correct 2 ms 1884 KB Output is correct
26 Correct 3 ms 1884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 3 ms 1372 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 3 ms 1884 KB Output is correct
19 Correct 2 ms 1672 KB Output is correct
20 Correct 2 ms 1884 KB Output is correct
21 Correct 3 ms 1880 KB Output is correct
22 Correct 2 ms 1880 KB Output is correct
23 Correct 2 ms 1880 KB Output is correct
24 Correct 4 ms 1880 KB Output is correct
25 Correct 2 ms 1884 KB Output is correct
26 Correct 3 ms 1884 KB Output is correct
27 Correct 131 ms 51116 KB Output is correct
28 Correct 1 ms 600 KB Output is correct
29 Correct 5 ms 4184 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 82 ms 37580 KB Output is correct
32 Correct 91 ms 53856 KB Output is correct
33 Correct 102 ms 53840 KB Output is correct
34 Correct 118 ms 43600 KB Output is correct
35 Correct 120 ms 53616 KB Output is correct
36 Correct 100 ms 54040 KB Output is correct
37 Correct 143 ms 54192 KB Output is correct
38 Correct 58 ms 37204 KB Output is correct
39 Correct 65 ms 37764 KB Output is correct