# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
994451 | daffuwu | Bitaro the Brave (JOI19_ho_t1) | C++14 | 332 ms | 18104 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;
#define fr first
#define sc second
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long ans;
char a[3069][3069];
int cnt[3069][2], h, w; //{idx, row/col}
int main()
{
int i, j;
scanf("%d%d", &h, &w);
for (i=1; i<=h; i++)
{
for (j=1; j<=w; j++) scanf(" %c", &a[i][j]);
}
for (i=h; i>=1; i--)
{
for (j=w; j>=1; j--)
{
if (a[i][j] == 'J') ans += 1ll*cnt[i][0]*cnt[j][1];
else if (a[i][j] == 'O') cnt[i][0]++;
else cnt[j][1]++;
}
}
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... |