Submission #1023580

#TimeUsernameProblemLanguageResultExecution timeMemory
1023580vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
240 ms150440 KiB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m,orb[3003][3003],ingot[3003][3003],kq = 0;
char a[3003][3003];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
        cin >> a[i][j];
    memset(orb,0,sizeof(orb));
    memset(ingot,0,sizeof(ingot));
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
        {
            orb[i][j] = orb[i][j-1] + (a[i][j] == 'O');
        }
    for(int j = 1; j <= m; j++)
        for(int i = 1; i <= n; i++)
            ingot[i][j] = ingot[i-1][j] + (a[i][j] == 'I');
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
        if(a[i][j] == 'J')
            kq += (orb[i][m] - orb[i][j]) * (ingot[n][j] - ingot[i][j]);
    cout << kq;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...