# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
209194 | ffao | Bitaro the Brave (JOI19_ho_t1) | C++14 | 155 ms | 82340 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 <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <memory.h>
#include <cmath>
#include <array>
void re(int& x);
void re(char* c);
void pr(long long x);
void pr(const char *x);
void ps();
template<class T, class... Ts> void ps(const T& t, const Ts&... ts);
#ifdef FFDBG
#else
#define dbg(x...) dsfdsfsdfasd
#endif
void re(int& x) { scanf("%d", &x); }
void re(char* c) { scanf("%s", c); }
void pr(long long x) { printf("%lld", x); }
void pr(const char *x) { printf("%s", x); }
void ps() { pr("\n"); }
template<class T, class... Ts> void ps(const T& t, const Ts&... ts) {
pr(t); if (sizeof...(ts)) pr(" "); ps(ts...);
}
#define rep(i, a, b) for(int i = a; i < (b); ++i)
int r,c;
char board[3100][3100];
int orbs_right[3100][3100];
int ingots_below[3100][3100];
void solve()
{
re(r); re(c);
rep(i,0,r) re(board[i]);
for (int i = r-1; i>= 0; i--) {
for (int j = c-1; j >= 0; j--) {
orbs_right[i][j] = (orbs_right[i][j+1] + (board[i][j] == 'O'));
ingots_below[i][j] = (ingots_below[i+1][j] + (board[i][j] == 'I'));
}
}
long long ans = 0;
rep(i,0,r) rep(j,0,c) if (board[i][j] == 'J') ans += orbs_right[i][j] * ingots_below[i][j];
ps(ans);
}
int main() {
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... |