제출 #1289177

#제출 시각아이디문제언어결과실행 시간메모리
1289177muhammad-ahmadBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
137 ms150428 KiB
// #include <bits/stdc++.h> #include <iostream> #include <cmath> #include <algorithm> #include <map> #include <vector> #include <iomanip> #include <string> #include <queue> #include <set> #include <deque> #include <numeric> #include <stack> #include <chrono> using namespace std; #define int long long #define endl '\n' #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define fi first #define Se second void fast_io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout << fixed << setprecision(9); } void solve() { int n, m; cin >> n >> m; string s[n + 1]; for (int i = 1; i <= n; i++){ cin >> s[i]; s[i] = "." + s[i]; } int O[n + 1][m + 1] = {}, I[n + 1][m + 1] = {}; for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ O[i][j] = O[i][j - 1] + (s[i][j] == 'O'); I[i][j] = I[i - 1][j] + (s[i][j] == 'I'); } } int ans = 0; for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ if (s[i][j] == 'J') ans += (I[n][j] - I[i][j]) * (O[i][m] - O[i][j]); } } cout << ans << endl; return; } signed main() { fast_io(); srand(chrono::steady_clock::now().time_since_epoch().count()); int tc = 1; // cin >> tc; while (tc--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...