# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
225482 | Nightlight | Bitaro the Brave (JOI19_ho_t1) | C++14 | 272 ms | 81016 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 namespace std;
int H, W;
bitset<3005> grid[3005];
int Osum[3005][3005], Isum[3005][3005];
char tp;
long long ans;
int main() {
// freopen("inp", "r", stdin);
scanf("%d %d", &H, &W);
for(int i = 1; i <= H; i++) {
getchar();
for(int j = 1; j <= W; j++) {
tp = getchar();
if(tp == 'J') grid[i][j] = 1;
else if(tp == 'O') Osum[i][j] = 1;
else Isum[i][j] = 1;
Osum[i][j] += Osum[i][j - 1];
Isum[i][j] += Isum[i - 1][j];
}
}
for(int i = 1; i <= H; i++) {
for(int j = 1; j <= W; j++) {
if(grid[i][j]) {
ans += (Osum[i][W] - Osum[i][j]) * (Isum[H][j] - Isum[i][j]);
}
}
}
printf("%lld\n", ans);
}
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... |