Submission #364948

#TimeUsernameProblemLanguageResultExecution timeMemory
364948Lam_lai_cuoc_doiBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
94 ms18284 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; const bool typetest = 0; const int N = 3e3 + 5; const ll Inf = 1e17; int n, m, a[N], b; string s[N]; void Read() { cin >> m >> n; for (int i = 1; i <= m; ++i) { cin >> s[i]; s[i] = " " + s[i]; } } void Solve() { ll ans(0); for (int i = m; i; --i) { b = 0; for (int j = n; j; --j) { if (s[i][j] == 'J') ans += 1ll * a[j] * b; else if (s[i][j] == 'O') ++b; else ++a[j]; } } cout << ans; } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t(1); if (typetest) cin >> t; for (int _ = 1; _ <= t; ++_) { Read(); Solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...