# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
153353 | junodeveloper | Bitaro the Brave (JOI19_ho_t1) | C++14 | 311 ms | 53368 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 sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int h,w;
int tmp[3010][3010];
char s[3010][3010];
int main() {
scanf("%d%d",&h,&w);
int i,j;
for(i=0;i<h;i++) scanf("%s",s[i]);
for(i=0;i<h;i++) {
int c=0;
for(j=w-1;j>=0;j--) {
if(s[i][j]=='O') c++;
else if(s[i][j]=='J') tmp[i][j]=c;
}
}
ll ans=0;
for(j=0;j<w;j++) {
int c=0;
for(i=h-1;i>=0;i--) {
if(s[i][j]=='I') c++;
else if(s[i][j]=='J') ans+=tmp[i][j]*c;
}
}
printf("%lld",ans);
return 0;
}
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... |