# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136745 | hamzqq9 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 168 ms | 88572 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ii pair<int,int>
#define ll long long
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define orta ((bas+son)>>1)
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define inf 2000000000
#define N 3005
#define MOD 998244353
using namespace std;
char s[N][N];
int O[N][N],I[N][N];
int main() {
int h,w;
scanf("%d %d",&h,&w);
for(int i=1;i<=h;i++) scanf("%s",s[i]+1);
for(int i=1;i<=h;i++) {
for(int j=1;j<=w;j++) {
O[i][j]=O[i][j-1]+(s[i][j]=='O');
I[i][j]=I[i-1][j]+(s[i][j]=='I');
}
}
ll ans=0;
for(int i=1;i<=h;i++) {
for(int j=1;j<=w;j++) {
if(s[i][j]=='J') {
ans+=(I[h][j]-I[i-1][j])*(O[i][w]-O[i][j-1]);
}
}
}
printf("%lld",ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |