| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 795823 | Tien_Noob | Bitaro the Brave (JOI19_ho_t1) | C++17 | 214 ms | 53172 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.
//Make CSP great again
//Vengeance
#include <bits/stdc++.h>
#define TASK "TESTCODE"
using namespace std;
const int N = 3001;
int a[N + 1][N + 1], n, m;
char s[N + 1][N + 1];
void read()
{
    cin >> n >> m;
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = 1; j <= m; ++ j)
        {
            cin >> s[i][j];
        }
    }
}
void solve()
{   
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = m; j >= 1; -- j)
        {
            a[i][j] = a[i][j + 1];
            if (s[i][j] == 'O')
            {
                ++a[i][j];
            }
        }
    }
    long long res = 0;
    for (int j = 1; j <= m; ++ j)
    {   
        int sum = 0;
        for (int i = 1; i <= n; ++ i)
        {
            if (s[i][j] == 'J')
            {
                sum += a[i][j];
            }
            if (s[i][j] == 'I')
            {
                res += sum;
            }
        }
    }
    cout << res;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    if (fopen(TASK".INP", "r"))
    {
        freopen(TASK".INP", "r", stdin);
        //freopen(TASK".OUT", "w", stdout);
    }
    int t = 1;
    bool typetest = false;
    if (typetest)
    {
        cin >> t;
    }
    for (int __ = 1; __ <= t; ++ __)
    {
        //cout << "Case " << __ << ": ";
        read();
        solve();
    }
}
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... | ||||
