제출 #1274337

#제출 시각아이디문제언어결과실행 시간메모리
1274337kaiboyBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
201 ms79692 KiB
#include <algorithm> #include <iostream> using namespace std; const int N = 3000; const int M = 3000; char cc[N][M + 1]; int aa[N][M], bb[N][M]; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); int n, m; cin >> n >> m; for (int i = 0; i < n; i++) cin >> cc[i]; for (int i = 0; i < n; i++) for (int a = 0, j = m - 1; j >= 0; j--) aa[i][j] = a += cc[i][j] == 'O'; for (int j = 0; j < m; j++) for (int b = 0, i = n - 1; i >= 0; i--) bb[i][j] = b += cc[i][j] == 'I'; long long k = 0; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) if (cc[i][j] == 'J') k += aa[i][j] * bb[i][j]; cout << k << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...