# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100752 | ikura355 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 251 ms | 88440 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>
using namespace std;
const int maxn = 3e3 + 5;
int n,m;
char s[maxn][maxn];
long long a[maxn][maxn];
int main() {
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++) scanf(" %s",s[i]+1);
for(int i=1;i<=n;i++) {
int cnt = 0;
for(int j=m;j>=1;j--) {
cnt += s[i][j]=='O';
a[i][j] = cnt;
}
}
long long ans = 0;
for(int j=1;j<=m;j++) {
int cnt = 0;
for(int i=n;i>=1;i--) {
cnt += s[i][j]=='I';
if(s[i][j]=='J') ans += (long long)cnt * a[i][j];
}
}
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... |