Submission #520894

# Submission time Handle Problem Language Result Execution time Memory
520894 2022-01-31T12:04:34 Z emon_2007 Bitaro the Brave (JOI19_ho_t1) C++17
0 / 100
0 ms 332 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll h, w, cnt, a[3001][3001], b[3001][3001], k, l;
char c[3001][3001];

int main()
{
    cin >> h >> w;
    for(int i = 1; i <= h; i++)
    {
        for(int j = 1; j <= w; j++)
        {
            cin >> c[i][j];
        }
    }
    for(int i = h; i >= 1; i--)
    {
        for(int j = w; j >= 1; j--)
        {
            if(c[i][j] == 'I')
            {
                k++;
            }
            a[i][j] = k;
        }
        k = 0;
    }
    for(int i = h; i >= 1; i--)
    {
        for(int j = w; j >= 1; j--)
        {
            if(c[i][j] == 'O')
            {
                l++;
            }
            b[i][j] = l;
        }
        l = 0;
    }
    for(int i = 1; i <= h; i++)
    {
        for(int j = 1; j <= w; j++)
        {
            if(c[i][j] == 'J')
            {
                cnt += a[i][j] * b[i][j];
            }
        }
    }
    cout << cnt;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Incorrect 0 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Incorrect 0 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Incorrect 0 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -