Submission #1151443

#TimeUsernameProblemLanguageResultExecution timeMemory
1151443aagiiBitaro the Brave (JOI19_ho_t1)C++20
50 / 100
454 ms339968 KiB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define sz size()
#define veg vegeta
#define harderahhh ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 1e9+7;
using namespace std;
ll x, l, y, t, z, hp, sus1, sus2, g, sus, sus3, bruh, bruh1, bruh2, bruh3, dog1, h, r, dog2, dog3;
ll ck1, ck2, ck3, dog, i, p, j, q, m, a[1000005], b[696969], c[696969], n, k, d[696969], e[696969];
ll x2[696969], x17[696969], x1[696969], jo[1005][1005], pp[1005][1005], di[1234566], de[1234566];
string s1, s2, s3, s4, s5, s6, s7, s8, s9, rep1, rep2, rep, s, hsr[696969], gi[696969];
char c1, c2, oon, hi[1005][1005], na[3005][3005], cc[696969];
pair <ll, ll> goku[696969], veg[696969];
vector <ll> aag[500005], eeg[200005], ski, bidi;
bool vis[200005];
map <pair<ll,ll>, ll> mm;
map <ll, ll> wii[3005], waa[3005];
set <ll> baka[200005], kk;
void dfs(ll x) {
    
}
int main() { 
    harderahhh;
    cin >> n >> k;
    for (i = 1; i <= n; i++) {
        for (j = 1; j <= k; j++) {
            cin >> na[i][j];
        }
    }
    for (i = 1; i <= n; i++) {
        for (j = k; j >= 1; j--) {
            if (na[i][j] == 'O') {
                wii[i][j] = wii[i][j+1] + 1;
            } else {
                wii[i][j] = wii[i][j+1];
            }
        }
    }
    for (i = 1; i <= k; i++) {
        for (j = n; j >= 1; j--) {
            if (na[j][i] == 'I') {
                waa[j][i] = waa[j+1][i] + 1;
            } else {
                waa[j][i] = waa[j+1][i];
            }
        }
    }
    for (i = 1; i <= n; i++) {
        for (j = 1; j <= k; j++) {
            if (na[i][j] == 'J') {
                sus += wii[i][j]*waa[i][j];
            }
        }
    }
    cout << sus;
    
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...