# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
731110 | 2023-04-27T03:17:23 Z | sleepntsheep | Bitaro the Brave (JOI19_ho_t1) | C++17 | 886 ms | 256100 KB |
#include <bits/stdc++.h> using namespace std; const int N = 3005; int n, m; long long ans; int a[N][N]; int fr[N][N][3], fc[N][N][3]; const std::string JOI = "JOI"; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { char c; scanf(" %c", &c); int x = std::find(JOI.begin(), JOI.end(), c) - JOI.begin(); ++fr[i][j][x]; ++fc[j][i][x]; a[i][j] = x; } for (int j = 1; j <= m; j++) for (int i = n; i >= 1; i--) fc[j][i][2] += fc[j][i+1][2]; for (int i = 1; i <= n; i++) for (int j = m; j >= 1; j--) fr[i][j][1] += fr[i][j+1][1]; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { if (a[i][j] == 0) { ans += 1ll * fr[i][j][1] * 1ll * fc[j][i][2]; } } printf("%lld", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 308 KB | Output is correct |
3 | Correct | 1 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 2 ms | 1748 KB | Output is correct |
6 | Correct | 2 ms | 1620 KB | Output is correct |
7 | Correct | 2 ms | 1620 KB | Output is correct |
8 | Correct | 3 ms | 1748 KB | Output is correct |
9 | Correct | 1 ms | 1588 KB | Output is correct |
10 | Correct | 2 ms | 1620 KB | Output is correct |
11 | Correct | 2 ms | 1748 KB | Output is correct |
12 | Correct | 2 ms | 1620 KB | Output is correct |
13 | Correct | 2 ms | 1620 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 308 KB | Output is correct |
3 | Correct | 1 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 2 ms | 1748 KB | Output is correct |
6 | Correct | 2 ms | 1620 KB | Output is correct |
7 | Correct | 2 ms | 1620 KB | Output is correct |
8 | Correct | 3 ms | 1748 KB | Output is correct |
9 | Correct | 1 ms | 1588 KB | Output is correct |
10 | Correct | 2 ms | 1620 KB | Output is correct |
11 | Correct | 2 ms | 1748 KB | Output is correct |
12 | Correct | 2 ms | 1620 KB | Output is correct |
13 | Correct | 2 ms | 1620 KB | Output is correct |
14 | Correct | 17 ms | 11220 KB | Output is correct |
15 | Correct | 2 ms | 3896 KB | Output is correct |
16 | Correct | 12 ms | 8020 KB | Output is correct |
17 | Correct | 1 ms | 1620 KB | Output is correct |
18 | Correct | 23 ms | 13368 KB | Output is correct |
19 | Correct | 22 ms | 13032 KB | Output is correct |
20 | Correct | 22 ms | 13184 KB | Output is correct |
21 | Correct | 23 ms | 13568 KB | Output is correct |
22 | Correct | 22 ms | 13040 KB | Output is correct |
23 | Correct | 20 ms | 13212 KB | Output is correct |
24 | Correct | 22 ms | 13396 KB | Output is correct |
25 | Correct | 20 ms | 13012 KB | Output is correct |
26 | Correct | 22 ms | 13140 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 308 KB | Output is correct |
3 | Correct | 1 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 2 ms | 1748 KB | Output is correct |
6 | Correct | 2 ms | 1620 KB | Output is correct |
7 | Correct | 2 ms | 1620 KB | Output is correct |
8 | Correct | 3 ms | 1748 KB | Output is correct |
9 | Correct | 1 ms | 1588 KB | Output is correct |
10 | Correct | 2 ms | 1620 KB | Output is correct |
11 | Correct | 2 ms | 1748 KB | Output is correct |
12 | Correct | 2 ms | 1620 KB | Output is correct |
13 | Correct | 2 ms | 1620 KB | Output is correct |
14 | Correct | 17 ms | 11220 KB | Output is correct |
15 | Correct | 2 ms | 3896 KB | Output is correct |
16 | Correct | 12 ms | 8020 KB | Output is correct |
17 | Correct | 1 ms | 1620 KB | Output is correct |
18 | Correct | 23 ms | 13368 KB | Output is correct |
19 | Correct | 22 ms | 13032 KB | Output is correct |
20 | Correct | 22 ms | 13184 KB | Output is correct |
21 | Correct | 23 ms | 13568 KB | Output is correct |
22 | Correct | 22 ms | 13040 KB | Output is correct |
23 | Correct | 20 ms | 13212 KB | Output is correct |
24 | Correct | 22 ms | 13396 KB | Output is correct |
25 | Correct | 20 ms | 13012 KB | Output is correct |
26 | Correct | 22 ms | 13140 KB | Output is correct |
27 | Correct | 886 ms | 249684 KB | Output is correct |
28 | Correct | 10 ms | 19796 KB | Output is correct |
29 | Correct | 69 ms | 30360 KB | Output is correct |
30 | Correct | 7 ms | 10324 KB | Output is correct |
31 | Correct | 618 ms | 202708 KB | Output is correct |
32 | Correct | 862 ms | 255404 KB | Output is correct |
33 | Correct | 836 ms | 255640 KB | Output is correct |
34 | Correct | 717 ms | 226624 KB | Output is correct |
35 | Correct | 832 ms | 255288 KB | Output is correct |
36 | Correct | 820 ms | 255588 KB | Output is correct |
37 | Correct | 884 ms | 256100 KB | Output is correct |
38 | Correct | 575 ms | 201676 KB | Output is correct |
39 | Correct | 567 ms | 201840 KB | Output is correct |