제출 #118700

#제출 시각아이디문제언어결과실행 시간메모리
118700M_H_H_7Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
491 ms188664 KiB
//In The Name of Beauty #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; #define IB std::ios::sync_with_stdio(0); #define pb(x) push_back(x); #define mp(x,y) make_pair(x,y) #define pll pair<ll,ll> #define F first #define S second ll const MAXN = 5e3 + 8; ll const INF = 1e12 + 8; ll const delta = 1000000007; char table[MAXN][MAXN]; ll I[MAXN][MAXN], O[MAXN][MAXN]; int main() { IB; cin.tie(0); cout.tie(0); ll n , m; cin >> n >> m; for(ll i = 1;i <= n;i++){ for(ll j = 1;j <= m;j++)cin >> table[i][j]; } for(ll i = 1;i <= n;i++){ ll temp = 0; for(ll j = m;j >= 1;j--){ temp += (table[i][j] == 'O'); O[i][j] = temp; } } for(ll i = 1;i <= m;i++){ ll temp = 0; for(ll j = n;j >= 1;j--){ temp += (table[j][i] == 'I'); I[j][i] = temp; } } ll ans = 0; for(ll i = 1;i <= n;i++){ for(ll j = 1;j <= m;j++){ if(table[i][j] != 'J')continue; ans += (I[i][j] * O[i][j]); } } cout << ans; return 0; } //Written by M_H_H_7
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...