# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
160484 | kingfran1907 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 168 ms | 53372 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;
typedef long long llint;
const int maxn = 3010;
int n, m;
char niz[maxn][maxn];
int pref[maxn][maxn];
llint cnt[maxn];
int main() {
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++)
scanf("%s", niz+i);
llint sol = 0;
for (int i = 0; i < n; i++) {
for (int j = m - 1; j >= 0; j--)
pref[i][j] = pref[i][j + 1] + (niz[i][j] == 'O');
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (niz[i][j] == 'J') cnt[j] += pref[i][j];
else if (niz[i][j] == 'I') {
sol += cnt[j];
//printf("%d %d -> %d\n", i, j, cnt[j]);
}
}
}
printf("%lld\n", sol);
return 0;
}
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... |