제출 #1185905

#제출 시각아이디문제언어결과실행 시간메모리
1185905jerzykBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
56 ms456 KiB
#include <bits/stdc++.h>

using namespace std;
#define pb push_back
#define st first
#define nd second
typedef long long ll;
typedef long double ld;
const ll I = 1'000'000'000'000'000'000LL;
const int II = 2'000'000'000;
const ll M = 1'000'000'007LL;
const int N = 4'000;
int il[N];

void Solve()
{
    int n, m, cur;
    ll answer = 0LL;
    string s;
    cin >> n >> m;
    for(int i = 1; i <= n; ++i)
    {
        cin >> s;
        cur = 0;
        for(int j = m - 1; j >= 0; --j)
        {
            if(s[j] == 'O') ++cur;
            if(s[j] == 'J') il[j] += cur;
            if(s[j] == 'I') answer += (ll)il[j];
        }
    }
    cout << answer << "\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //int t; cin >> t;
    //while(t--)
        Solve();

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...