제출 #531973

#제출 시각아이디문제언어결과실행 시간메모리
531973syl123456Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
91 ms80440 KiB
#include <bits/stdc++.h> #define all(i) (i).begin(), (i).end() using namespace std; template<typename T1, typename ...T2> void debug(bool _split, T1 i, T2 ...j) { if (_split) cerr << ", "; cerr << i; debug(true, j...); } #define debug(args...) cout << "Line" << __LINE__ << " : [" << #args << << "] is [" << debug(false, args) << "]" << endl; typedef pair<int, int> pi; typedef long long ll; const int inf = 0x3f3f3f3f, lg = 20; const ll mod = 1e9 + 7, INF = 0x3f3f3f3f; signed main() { ios::sync_with_stdio(0), cin.tie(0); int n, m; cin >> n >> m; string s[n]; for (string &i : s) cin >> i; int a[n][m], b[n][m]; ll ans = 0; for (int i = n - 1; ~i; --i) for (int j = m - 1; ~j; --j) { a[i][j] = i < n - 1 ? a[i + 1][j] : 0; a[i][j] += s[i][j] == 'I'; b[i][j] = j < m - 1 ? b[i][j + 1] : 0; b[i][j] += s[i][j] == 'O'; if (s[i][j] == 'J') ans += a[i][j] * b[i][j]; } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...