제출 #1127794

#제출 시각아이디문제언어결과실행 시간메모리
1127794tsengangBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
176 ms10328 KiB
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(), x.end() #define vodka void #define ertunt return using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll h, w; cin >> h >> w; vector<string> s(h); vector<ll> J(h + 5,0), O(h + 5,0), I(w + 5,0); for (ll i = 0; i < h; i++) { cin >> s[i]; for (ll j = 0; j < w; j++) { if (s[i][j] == 'O') O[i]++; } } for (ll i = 0; i < w; i++) { for (ll j = 0; j < h; j++) { if (s[j][i] == 'I') I[i]++; } } ll ans = 0; for (ll i = 0; i < h; i++) { for (ll j = 0; j < w; j++) { if (s[i][j] == 'J') { ans+=I[j]*O[i]; } if (s[i][j] == 'O') O[i]--; if (s[i][j] == 'I') I[j]--; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...