Submission #1258714

#TimeUsernameProblemLanguageResultExecution timeMemory
1258714thethao2202Bitaro the Brave (JOI19_ho_t1)C++20
20 / 100
7 ms7752 KiB
#include <bits/stdc++.h>
using namespace std;
int h, w, tong = 0;
char s[3005][3005];
int a[3005][3005], b[3005][3005], c[3005][3005];
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> h >> w;
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            cin >> s[i][j];
        }
    }
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            // a[i][j] = a[i][j - 1] + (s[i][j] == 'J');
            b[i][j] = b[i - 1][j] + (s[i][j] == 'I');
            c[i][j] = c[i][j - 1] + (s[i][j] == 'O');
        }
    }
    // for (int i = 1; i <= h; i++)
    // {
    //     for (int j = 1; j <= w; j++)
    //     {
    //         cout << c[i][j] << ' ';
    //     }
    //     cout << '\n';
    // }
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if (s[i][j] == 'J')
            {
                tong = tong + (b[h][j] - b[i - 1][j]) * (c[i][w] - c[i][j - 1]);
            }
        }
    }
    cout << tong;
}

Compilation message (stderr)

joi2019_ho_t1.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...