제출 #595235

#제출 시각아이디문제언어결과실행 시간메모리
595235shrimbBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
241 ms158796 KiB
#include"bits/stdc++.h"
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;

#define int long long
#define endl '\n'
#define mod 1000000007
//\
#define mod 1686876991

const int maxn = 3001;

char g[maxn][maxn];
int suffO[maxn][maxn], suffI[maxn][maxn];
signed main () {
    cin.tie(0)->sync_with_stdio(0);

    int n, m;

    cin >> n >> m;


    for (int i = 0 ; i < n ; i++) {
        for (int j = 0 ; j < m ; j++) cin >> g[i][j];
    }

    int ans = 0;

    for (int i = n - 1 ; i >= 0 ; i--) {
        for (int j = m - 1 ; j >= 0 ; j--) {
            if (i + 1 < n) suffO[i][j] = suffO[i + 1][j];
            suffO[i][j] += g[i][j] == 'I';
            if (j + 1 < m) suffI[i][j] = suffI[i][j + 1];
            suffI[i][j] += g[i][j] == 'O';
            if (g[i][j] == 'J') {
                ans += suffO[i][j] * suffI[i][j];
            }
        }
    }

    cout << ans << endl;
}

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t1.cpp:14:1: warning: multi-line comment [-Wcomment]
   14 | //\
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...