Submission #521274

# Submission time Handle Problem Language Result Execution time Memory
521274 2022-02-01T12:51:47 Z AdamGS Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
273 ms 160044 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=3e3+7;
string T[LIM];
ll lewo[LIM][LIM], dol[LIM][LIM];
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, m;
	cin >> n >> m;
	rep(i, n) {
		cin >> T[i];
		for(int j=m-1; j>=0; --j) lewo[i][j]=lewo[i][j+1]+(T[i][j]=='O');
	}
	rep(j, m) {
		for(int i=n-1; i>=0; --i) dol[i][j]=dol[i+1][j]+(T[i][j]=='I');
	}
	ll ans=0;
	rep(i, n) rep(j, m) if(T[i][j]=='J') ans+=lewo[i][j]*dol[i][j];
	cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 412 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1228 KB Output is correct
8 Correct 1 ms 1320 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1228 KB Output is correct
11 Correct 1 ms 1356 KB Output is correct
12 Correct 1 ms 1316 KB Output is correct
13 Correct 1 ms 1228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 412 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1228 KB Output is correct
8 Correct 1 ms 1320 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1228 KB Output is correct
11 Correct 1 ms 1356 KB Output is correct
12 Correct 1 ms 1316 KB Output is correct
13 Correct 1 ms 1228 KB Output is correct
14 Correct 6 ms 7756 KB Output is correct
15 Correct 2 ms 3788 KB Output is correct
16 Correct 3 ms 4684 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 8 ms 8780 KB Output is correct
19 Correct 7 ms 8656 KB Output is correct
20 Correct 6 ms 8624 KB Output is correct
21 Correct 6 ms 8860 KB Output is correct
22 Correct 7 ms 8612 KB Output is correct
23 Correct 6 ms 8652 KB Output is correct
24 Correct 7 ms 8748 KB Output is correct
25 Correct 6 ms 8652 KB Output is correct
26 Correct 6 ms 8620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 412 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1228 KB Output is correct
8 Correct 1 ms 1320 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1228 KB Output is correct
11 Correct 1 ms 1356 KB Output is correct
12 Correct 1 ms 1316 KB Output is correct
13 Correct 1 ms 1228 KB Output is correct
14 Correct 6 ms 7756 KB Output is correct
15 Correct 2 ms 3788 KB Output is correct
16 Correct 3 ms 4684 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 8 ms 8780 KB Output is correct
19 Correct 7 ms 8656 KB Output is correct
20 Correct 6 ms 8624 KB Output is correct
21 Correct 6 ms 8860 KB Output is correct
22 Correct 7 ms 8612 KB Output is correct
23 Correct 6 ms 8652 KB Output is correct
24 Correct 7 ms 8748 KB Output is correct
25 Correct 6 ms 8652 KB Output is correct
26 Correct 6 ms 8620 KB Output is correct
27 Correct 248 ms 158936 KB Output is correct
28 Correct 10 ms 19532 KB Output is correct
29 Correct 12 ms 13828 KB Output is correct
30 Correct 1 ms 844 KB Output is correct
31 Correct 181 ms 130824 KB Output is correct
32 Correct 233 ms 159948 KB Output is correct
33 Correct 232 ms 159580 KB Output is correct
34 Correct 210 ms 151748 KB Output is correct
35 Correct 237 ms 159912 KB Output is correct
36 Correct 237 ms 159492 KB Output is correct
37 Correct 273 ms 160044 KB Output is correct
38 Correct 181 ms 130192 KB Output is correct
39 Correct 193 ms 130320 KB Output is correct