# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
485206 | 2021-11-06T15:00:55 Z | chungdinh | Bitaro the Brave (JOI19_ho_t1) | C++17 | 262 ms | 91004 KB |
#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); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 776 KB | Output is correct |
6 | Correct | 1 ms | 844 KB | Output is correct |
7 | Correct | 1 ms | 844 KB | Output is correct |
8 | Correct | 1 ms | 844 KB | Output is correct |
9 | Correct | 1 ms | 844 KB | Output is correct |
10 | Correct | 1 ms | 844 KB | Output is correct |
11 | Correct | 1 ms | 844 KB | Output is correct |
12 | Correct | 1 ms | 844 KB | Output is correct |
13 | Correct | 1 ms | 844 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 776 KB | Output is correct |
6 | Correct | 1 ms | 844 KB | Output is correct |
7 | Correct | 1 ms | 844 KB | Output is correct |
8 | Correct | 1 ms | 844 KB | Output is correct |
9 | Correct | 1 ms | 844 KB | Output is correct |
10 | Correct | 1 ms | 844 KB | Output is correct |
11 | Correct | 1 ms | 844 KB | Output is correct |
12 | Correct | 1 ms | 844 KB | Output is correct |
13 | Correct | 1 ms | 844 KB | Output is correct |
14 | Correct | 7 ms | 4300 KB | Output is correct |
15 | Correct | 1 ms | 2124 KB | Output is correct |
16 | Correct | 4 ms | 2764 KB | Output is correct |
17 | Correct | 1 ms | 392 KB | Output is correct |
18 | Correct | 10 ms | 4988 KB | Output is correct |
19 | Correct | 7 ms | 4752 KB | Output is correct |
20 | Correct | 8 ms | 4940 KB | Output is correct |
21 | Correct | 8 ms | 5068 KB | Output is correct |
22 | Correct | 8 ms | 4684 KB | Output is correct |
23 | Correct | 8 ms | 4956 KB | Output is correct |
24 | Correct | 9 ms | 5068 KB | Output is correct |
25 | Correct | 7 ms | 4704 KB | Output is correct |
26 | Correct | 8 ms | 4924 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 776 KB | Output is correct |
6 | Correct | 1 ms | 844 KB | Output is correct |
7 | Correct | 1 ms | 844 KB | Output is correct |
8 | Correct | 1 ms | 844 KB | Output is correct |
9 | Correct | 1 ms | 844 KB | Output is correct |
10 | Correct | 1 ms | 844 KB | Output is correct |
11 | Correct | 1 ms | 844 KB | Output is correct |
12 | Correct | 1 ms | 844 KB | Output is correct |
13 | Correct | 1 ms | 844 KB | Output is correct |
14 | Correct | 7 ms | 4300 KB | Output is correct |
15 | Correct | 1 ms | 2124 KB | Output is correct |
16 | Correct | 4 ms | 2764 KB | Output is correct |
17 | Correct | 1 ms | 392 KB | Output is correct |
18 | Correct | 10 ms | 4988 KB | Output is correct |
19 | Correct | 7 ms | 4752 KB | Output is correct |
20 | Correct | 8 ms | 4940 KB | Output is correct |
21 | Correct | 8 ms | 5068 KB | Output is correct |
22 | Correct | 8 ms | 4684 KB | Output is correct |
23 | Correct | 8 ms | 4956 KB | Output is correct |
24 | Correct | 9 ms | 5068 KB | Output is correct |
25 | Correct | 7 ms | 4704 KB | Output is correct |
26 | Correct | 8 ms | 4924 KB | Output is correct |
27 | Correct | 241 ms | 90556 KB | Output is correct |
28 | Correct | 7 ms | 9932 KB | Output is correct |
29 | Correct | 20 ms | 7984 KB | Output is correct |
30 | Correct | 1 ms | 588 KB | Output is correct |
31 | Correct | 184 ms | 74672 KB | Output is correct |
32 | Correct | 229 ms | 90924 KB | Output is correct |
33 | Correct | 234 ms | 90692 KB | Output is correct |
34 | Correct | 224 ms | 86528 KB | Output is correct |
35 | Correct | 240 ms | 90896 KB | Output is correct |
36 | Correct | 262 ms | 90756 KB | Output is correct |
37 | Correct | 262 ms | 91004 KB | Output is correct |
38 | Correct | 175 ms | 74364 KB | Output is correct |
39 | Correct | 166 ms | 74332 KB | Output is correct |