Submission #208395

# Submission time Handle Problem Language Result Execution time Memory
208395 2020-03-11T06:44:08 Z YJU Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
165 ms 184052 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll MOD=1e9+7;
const ll N=5e3+5;
const ld pi=3.14159265359;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(a) (ll)a.size()

ll n,m,O[N][N],I[N][N],ans;
string s[N];

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>m;
	REP1(i,n)cin>>s[i];
	REP1(i,n)REP(j,m){
		O[i][j]=(j==0?0:O[i][j-1])+(s[i][j]=='O');
		I[i][j]=I[i-1][j]+(s[i][j]=='I');
	}
	REP1(i,n){
		REP(j,m){
			if(s[i][j]=='J'){
				ans+=(I[n][j]-I[i][j])*(O[i][m-1]-O[i][j]);
			}
		}
	}
	cout<<ans<<"\n";
	return 0;
}


# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 5 ms 1528 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 5 ms 1528 KB Output is correct
12 Correct 6 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 5 ms 1528 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 5 ms 1528 KB Output is correct
12 Correct 6 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
14 Correct 10 ms 7928 KB Output is correct
15 Correct 6 ms 3960 KB Output is correct
16 Correct 9 ms 4856 KB Output is correct
17 Correct 5 ms 632 KB Output is correct
18 Correct 11 ms 8952 KB Output is correct
19 Correct 11 ms 8824 KB Output is correct
20 Correct 10 ms 8824 KB Output is correct
21 Correct 11 ms 8952 KB Output is correct
22 Correct 10 ms 8828 KB Output is correct
23 Correct 10 ms 8824 KB Output is correct
24 Correct 11 ms 8952 KB Output is correct
25 Correct 10 ms 8824 KB Output is correct
26 Correct 10 ms 8824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 5 ms 1528 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 5 ms 1528 KB Output is correct
12 Correct 6 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
14 Correct 10 ms 7928 KB Output is correct
15 Correct 6 ms 3960 KB Output is correct
16 Correct 9 ms 4856 KB Output is correct
17 Correct 5 ms 632 KB Output is correct
18 Correct 11 ms 8952 KB Output is correct
19 Correct 11 ms 8824 KB Output is correct
20 Correct 10 ms 8824 KB Output is correct
21 Correct 11 ms 8952 KB Output is correct
22 Correct 10 ms 8828 KB Output is correct
23 Correct 10 ms 8824 KB Output is correct
24 Correct 11 ms 8952 KB Output is correct
25 Correct 10 ms 8824 KB Output is correct
26 Correct 10 ms 8824 KB Output is correct
27 Correct 156 ms 175092 KB Output is correct
28 Correct 14 ms 19832 KB Output is correct
29 Correct 14 ms 14072 KB Output is correct
30 Correct 5 ms 1016 KB Output is correct
31 Correct 114 ms 131192 KB Output is correct
32 Correct 135 ms 182904 KB Output is correct
33 Correct 131 ms 183416 KB Output is correct
34 Correct 133 ms 152184 KB Output is correct
35 Correct 131 ms 182904 KB Output is correct
36 Correct 130 ms 183416 KB Output is correct
37 Correct 165 ms 184052 KB Output is correct
38 Correct 97 ms 130296 KB Output is correct
39 Correct 97 ms 130740 KB Output is correct