# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1082619 | lamlamlam | Bitaro the Brave (JOI19_ho_t1) | C++17 | 179 ms | 141812 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
#define endl '\n'
const int MN = 2005;
int n,m,cnt_o[MN][MN],cnt_i[MN][MN];
char a[MN][MN];
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#define task "sus"
if(fopen(task".inp","r")){
freopen(task".inp","r",stdin);
freopen(task".out","w",stdout);
}
cin >> n >> m;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
cin >> a[i][j];
if(a[i][j]=='O') cnt_o[i][j]++;
if(a[i][j]=='I') cnt_i[i][j]++;
}
}
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
cnt_o[i][j] += cnt_o[i][j-1];
cnt_i[i][j] += cnt_i[i-1][j];
}
}
int ans = 0;
for(int i=1; i<=n; i++) for(int j=1; j<=m; j++) if(a[i][j]=='J')
ans += (cnt_o[i][m]-cnt_o[i][j])*(cnt_i[n][j]-cnt_i[i][j]);
cout << ans;
cerr << "\nTime: " << clock();
}
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... |