# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
591147 | dryeab | Bitaro the Brave (JOI19_ho_t1) | C++17 | 5 ms | 848 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int h, w;
cin >> h >> w;
vector<vector<char>> grid(h, vector<char>(w)), mark(h, vector<char>(w));
char c;
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; ++j)
cin >> grid[i][j];
}
int ok;
for (int i = 0; i < w; ++i) {
ok = 0;
for (int j = h - 1; j >= 0; --j) {
if (grid[j][i] == 'I')
ok++;
else if (grid[j][i] == 'J' && ok)
mark[j][i] = ok;
}
}
int res = 0, cnt;
for (int i = 0; i < h; ++i) {
cnt = 0;
for (int j = 0; j < w; ++j) {
cnt += mark[i][j];
if (grid[i][j] == 'O')
res += cnt;
}
}
cout << res;
}
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... |