| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1291532 | anhphant | Bitaro the Brave (JOI19_ho_t1) | C++20 | 129 ms | 150448 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, m;
char a[3007][3007];
ll pO[3007][3007], pS[3007][3007];
void solve() {
cin >> n >> m;
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= m; ++j) {
cin >> a[i][j];
}
}
ll ans = 0;
for(int i = n; i >= 1; --i) {
for(int j = m; j >= 1; --j) {
pO[i][j] = pO[i][j + 1] + (a[i][j] == 'O');
pS[i][j] = pS[i + 1][j] + (a[i][j] == 'I');
ans += (a[i][j] == 'J') * pO[i][j] * pS[i][j];
}
}
cout << ans << '\n';
}
int main() {
ios_base :: sync_with_stdio(0);
cin.tie(0); cout.tie(0); cerr.tie(0);
if (fopen("test.inp", "r")) {
freopen("test.inp", "r", stdin);
freopen("test.out", "w", stdout);
}
solve();
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
