# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1047827 | 2024-08-07T16:21:09 Z | manhlinh1501 | Bitaro the Brave (JOI19_ho_t1) | C++17 | 113 ms | 88660 KB |
#include <bits/stdc++.h> using namespace std; using i64 = long long; const int MAXN = 3e3 + 5; int N, M; char a[MAXN][MAXN]; int cO[MAXN][MAXN]; int cI[MAXN][MAXN]; signed main() { #define TASK "code" if (fopen(TASK ".inp", "r")) { freopen(TASK ".inp", "r", stdin); freopen(TASK ".out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> M; for(int i = 1; i <= N; i++) { for(int j = 1; j <= M; j++) cin >> a[i][j]; } for(int i = 1; i <= N; i++) { int cnt = 0; for(int j = M; j >= 1; j--) { if(a[i][j] == 'O') cnt++; cO[i][j] = cnt; } } for(int j = 1; j <= M; j++) { int cnt = 0; for(int i = N; i >= 1; i--) { if(a[i][j] == 'I') cnt++; cI[i][j] = cnt; } } i64 ans = 0; for(int i = 1; i <= N; i++) { for(int j = 1; j <= M; j++) { if(a[i][j] == 'J') ans += 1LL * cO[i][j] * cI[i][j]; } } cout << ans; return (0 ^ 0); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4440 KB | Output is correct |
2 | Correct | 1 ms | 4440 KB | Output is correct |
3 | Correct | 0 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 4444 KB | Output is correct |
5 | Correct | 1 ms | 6488 KB | Output is correct |
6 | Correct | 1 ms | 6620 KB | Output is correct |
7 | Correct | 1 ms | 6616 KB | Output is correct |
8 | Correct | 1 ms | 6748 KB | Output is correct |
9 | Correct | 1 ms | 6492 KB | Output is correct |
10 | Correct | 1 ms | 6492 KB | Output is correct |
11 | Correct | 1 ms | 6492 KB | Output is correct |
12 | Correct | 1 ms | 6492 KB | Output is correct |
13 | Correct | 1 ms | 6492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4440 KB | Output is correct |
2 | Correct | 1 ms | 4440 KB | Output is correct |
3 | Correct | 0 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 4444 KB | Output is correct |
5 | Correct | 1 ms | 6488 KB | Output is correct |
6 | Correct | 1 ms | 6620 KB | Output is correct |
7 | Correct | 1 ms | 6616 KB | Output is correct |
8 | Correct | 1 ms | 6748 KB | Output is correct |
9 | Correct | 1 ms | 6492 KB | Output is correct |
10 | Correct | 1 ms | 6492 KB | Output is correct |
11 | Correct | 1 ms | 6492 KB | Output is correct |
12 | Correct | 1 ms | 6492 KB | Output is correct |
13 | Correct | 1 ms | 6492 KB | Output is correct |
14 | Correct | 4 ms | 19032 KB | Output is correct |
15 | Correct | 1 ms | 14684 KB | Output is correct |
16 | Correct | 2 ms | 10840 KB | Output is correct |
17 | Correct | 0 ms | 4444 KB | Output is correct |
18 | Correct | 4 ms | 19036 KB | Output is correct |
19 | Correct | 4 ms | 19036 KB | Output is correct |
20 | Correct | 4 ms | 16988 KB | Output is correct |
21 | Correct | 4 ms | 19036 KB | Output is correct |
22 | Correct | 4 ms | 19140 KB | Output is correct |
23 | Correct | 5 ms | 16988 KB | Output is correct |
24 | Correct | 5 ms | 19272 KB | Output is correct |
25 | Correct | 6 ms | 19036 KB | Output is correct |
26 | Correct | 4 ms | 17056 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4440 KB | Output is correct |
2 | Correct | 1 ms | 4440 KB | Output is correct |
3 | Correct | 0 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 4444 KB | Output is correct |
5 | Correct | 1 ms | 6488 KB | Output is correct |
6 | Correct | 1 ms | 6620 KB | Output is correct |
7 | Correct | 1 ms | 6616 KB | Output is correct |
8 | Correct | 1 ms | 6748 KB | Output is correct |
9 | Correct | 1 ms | 6492 KB | Output is correct |
10 | Correct | 1 ms | 6492 KB | Output is correct |
11 | Correct | 1 ms | 6492 KB | Output is correct |
12 | Correct | 1 ms | 6492 KB | Output is correct |
13 | Correct | 1 ms | 6492 KB | Output is correct |
14 | Correct | 4 ms | 19032 KB | Output is correct |
15 | Correct | 1 ms | 14684 KB | Output is correct |
16 | Correct | 2 ms | 10840 KB | Output is correct |
17 | Correct | 0 ms | 4444 KB | Output is correct |
18 | Correct | 4 ms | 19036 KB | Output is correct |
19 | Correct | 4 ms | 19036 KB | Output is correct |
20 | Correct | 4 ms | 16988 KB | Output is correct |
21 | Correct | 4 ms | 19036 KB | Output is correct |
22 | Correct | 4 ms | 19140 KB | Output is correct |
23 | Correct | 5 ms | 16988 KB | Output is correct |
24 | Correct | 5 ms | 19272 KB | Output is correct |
25 | Correct | 6 ms | 19036 KB | Output is correct |
26 | Correct | 4 ms | 17056 KB | Output is correct |
27 | Correct | 105 ms | 88148 KB | Output is correct |
28 | Correct | 5 ms | 66136 KB | Output is correct |
29 | Correct | 6 ms | 11488 KB | Output is correct |
30 | Correct | 1 ms | 4696 KB | Output is correct |
31 | Correct | 73 ms | 76368 KB | Output is correct |
32 | Correct | 102 ms | 88632 KB | Output is correct |
33 | Correct | 109 ms | 88660 KB | Output is correct |
34 | Correct | 85 ms | 86608 KB | Output is correct |
35 | Correct | 97 ms | 88640 KB | Output is correct |
36 | Correct | 90 ms | 88656 KB | Output is correct |
37 | Correct | 113 ms | 88516 KB | Output is correct |
38 | Correct | 63 ms | 76348 KB | Output is correct |
39 | Correct | 67 ms | 76348 KB | Output is correct |