# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
485206 | chungdinh | Bitaro the Brave (JOI19_ho_t1) | C++17 | 262 ms | 91004 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <string>
#include <queue>
#include <iostream>
using namespace std;
#define endl "\n"
#define cntbit(x) __builtin_popcount(x)
#define on(b, x) (b & (1 << x))
#define all(x) x.begin(), x.end()
#define gcd __gcd
#define ll long long
#define ii pair<int, int>
const int N = 3e3 + 5;
const ll MOD = 998244353;
const int iINF = 1e9;
const ll INF = 1e18;
int n, m;
string g[N];
ii z[N][N];
int main() {
#ifdef CHUNGDINH
freopen("main.inp", "r", stdin);
#endif
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) cin >> g[i];
ll res = 0;
for (int i = n - 1; i >= 0; i--) {
for (int j = m - 1; j >= 0; j--) {
ii &a = z[i][j];
if (i == n - 1) a.first = 0;
else a.first = z[i + 1][j].first + (g[i + 1][j] == 'I');
if (j == m - 1) a.second = 0;
else a.second = z[i][j + 1].second + (g[i][j + 1] == 'O');
if (g[i][j] == 'J') res += (ll)a.first * a.second;
}
}
printf("%lld", res);
}
컴파일 시 표준 에러 (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... |