제출 #896811

#제출 시각아이디문제언어결과실행 시간메모리
896811oblantisBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
143 ms54192 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define all(v) v.begin(), v.end() #define pb push_back #define ss second #define ff first #define vt vector using namespace std; //using namespace __gnu_pbds; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, int> pdi; const ll inf = 1e18 + 10000; const int mod = 1e9+7; const int maxn = 2e5 + 12; void solve() { int n, m; cin >> n >> m; string s[n]; int cnt[n][m + 1]; for(int i = 0; i < n; i++) { cin >> s[i]; cnt[i][m] = 0; for(int j = m - 1; j >= 0; j--){ cnt[i][j] = cnt[i][j + 1]; if(s[i][j] == 'O')cnt[i][j]++; } } ll ans = 0; for(int j = 0; j < m; j++){ int I = 0; for(int i = n - 1; i >= 0; i--){ if(s[i][j] == 'J')ans += cnt[i][j] * I; if(s[i][j] == 'I')I++; } } cout << ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int times = 1; //cin >> times; for(int i = 1; i <= times; i++) { solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...