제출 #1203805

#제출 시각아이디문제언어결과실행 시간메모리
1203805chawinknBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
98 ms80148 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int h, w; cin >> h >> w; vector<string> s(h+1); vector<vector<int>> O(h+1, vector<int>(w+1)), I(h+1, vector<int>(w+1)); for (int i = 1; i <= h; i++) { cin >> s[i]; s[i] = ' '+s[i]; for (int j = 1; j <= w; j++) { O[i][j] = O[i][j-1]+(s[i][j] == 'O'); I[i][j] = I[i-1][j]+(s[i][j] == 'I'); } } ll ans=0; for (int i = 1; i <= h; i++) for (int j = 1; j <= w; j++) if (s[i][j] == 'J') ans += (O[i][w]-O[i][j])*(I[h][j]-I[i][j]); cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...