# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
926880 | haru09 | Bitaro the Brave (JOI19_ho_t1) | C++17 | 150 ms | 18020 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 ll long long
#define fi first
#define se second
#define task "code"
const int ar=3e3+5;
const ll mod=1e9+7;
int m,n;
char a[ar][ar];
int cnt[ar];
ll ans=0;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
if (fopen(task".inp","r"))
{
freopen(task".inp","r",stdin);
freopen(task".out","w",stdout);
}
cin>>m>>n;
for (int i=1;i<=m;i++)
{
for (int j=1;j<=n;j++)
{
cin>>a[i][j];
}
}
for (int i=m;i>=1;i--)
{
int sum=0;
for (int j=1;j<=n;j++)
{
if (a[i][j]=='J') sum+=cnt[j];
else if (a[i][j]=='O')
{
ans+=sum;
}
}
for (int j=1;j<=n;j++)
{
if (a[i][j]=='I') cnt[j]++;
}
}
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... |