# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
497620 | penguin133 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 426 ms | 88548 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;
#define int long long
int dp[1000005], P[3005], S[3005], L[3005][3005];
char g[3005][3005];
priority_queue<int>pq;
pair<int, int> A[1000005];
main(){
ios::sync_with_stdio(0);cin.tie(0);
int h,w,ans = 0;
cin >> h >> w;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++)cin >> g[i][j];
}
for(int i=1;i<=h;i++){
for(int j=w;j>=1;j--)L[i][j] = L[i][j+1] + (g[i][j] == 'O');
}
for(int i=1;i<=w;i++){
for(int j=1;j<=h;j++)P[j] = P[j-1] + (g[j][i] == 'J');
for(int j=h;j>=1;j--)S[j] = S[j+1] + (g[j][i] == 'I');
for(int j=1;j<=h;j++)ans += (g[j][i] == 'J') * S[j+1] * L[j][i+1];
}
cout << 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... |