제출 #1162552

#제출 시각아이디문제언어결과실행 시간메모리
1162552abysmalBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
282 ms11840 KiB
#include<algorithm> #include<complex> #include<iostream> #include<map> #include<queue> #include<set> #include<stdint.h> #include<vector> #ifdef LOCAL #include "dbg.h" #else #define dbg(...) #endif using namespace std; const int64_t INF = (int64_t) 1e18 + 777; const int64_t mINF = (int64_t) 1e9 + 777; const int64_t MOD = (int64_t) 1e9 + 7; struct Solution { Solution() {} void solve() { int n; int m; cin >> n >> m; vector<string> g(n); for(int i = 0; i < n; i++) { cin >> g[i]; } int64_t ans = 0; int cnt_row = 0; vector<int> cnt_col(m, 0); for(int i = n - 1; i >= 0; i--) { cnt_row = 0; for(int j = m - 1; j >= 0; j--) { if(g[i][j] == 'O') cnt_row++; if(g[i][j] == 'J') { ans += 1LL * cnt_row * cnt_col[j]; } } for(int j = m - 1; j >= 0; j--) { if(g[i][j] == 'I') cnt_col[j]++; } } cout << ans << "\n"; } int modadd(int a, int b) { int res = a + b; if(res >= MOD) res -= MOD; return res; } int modmul(int a, int b) { return (1LL * a * b) % MOD; } }; int main() { int t = 1; //cin >> t; for(int i = 0; i < t; i++) { Solution().solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...