제출 #252658

#제출 시각아이디문제언어결과실행 시간메모리
252658MlxaBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
123 ms158972 KiB
#include <bits/stdc++.h> #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #define x first #define y second using namespace std; using ll = long long; #define int ll const int N = 3003; int n, m; char s[N][N]; int a[N][N]; int b[N][N]; int ans = 0; signed main() { #ifdef LC assert(freopen("input.txt", "r", stdin)); #endif ios::sync_with_stdio(0), cin.tie(0); cin >> n >> m; for (int i = 0; i < n; ++i) { cin >> s[i]; } for (int i = n - 1; i >= 0; --i) { for (int j = m - 1; j >= 0; --j) { a[i][j] = a[i][j + 1] + (s[i][j] == 'O'); b[i][j] = b[i + 1][j] + (s[i][j] == 'I'); if (s[i][j] == 'J') { ans += a[i][j + 1] * b[i + 1][j]; } } } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...