# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404840 | 2021-05-15T06:15:17 Z | radaiosm7 | Bitaro the Brave (JOI19_ho_t1) | C++ | 274 ms | 88464 KB |
#include <bits/stdc++.h> using namespace std; #define X first #define Y second int n, m, i, j; char c, mat[3005][3005]; long long ans; vector<pair<int, int> > Jew; int col[3005][3005]; int row[3005][3005]; int main() { scanf("%d%d", &n, &m); for (i=0; i < n; ++i) { scanf("\n%s", mat[i]); } for (i=0; i < n; ++i) { row[i][m-1] = 0; for (j=m-1; j >= 0; --j) { row[i][j] = row[i][j+1] + (mat[i][j]=='O'); } } for (j=0; j < m; ++j) { col[n-1][j] = 0; for (i=n-1; i >= 0; --i) { col[i][j] = col[i+1][j] + (mat[i][j]=='I'); } } ans = 0LL; for (i=0; i < n; ++i) { for (j=0; j < m; ++j) { if (mat[i][j] == 'J') { ans += (long long)col[i][j]*row[i][j]; } } } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 1484 KB | Output is correct |
6 | Correct | 2 ms | 1356 KB | Output is correct |
7 | Correct | 1 ms | 1356 KB | Output is correct |
8 | Correct | 2 ms | 1484 KB | Output is correct |
9 | Correct | 1 ms | 1356 KB | Output is correct |
10 | Correct | 2 ms | 1356 KB | Output is correct |
11 | Correct | 1 ms | 1484 KB | Output is correct |
12 | Correct | 1 ms | 1356 KB | Output is correct |
13 | Correct | 1 ms | 1356 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 1484 KB | Output is correct |
6 | Correct | 2 ms | 1356 KB | Output is correct |
7 | Correct | 1 ms | 1356 KB | Output is correct |
8 | Correct | 2 ms | 1484 KB | Output is correct |
9 | Correct | 1 ms | 1356 KB | Output is correct |
10 | Correct | 2 ms | 1356 KB | Output is correct |
11 | Correct | 1 ms | 1484 KB | Output is correct |
12 | Correct | 1 ms | 1356 KB | Output is correct |
13 | Correct | 1 ms | 1356 KB | Output is correct |
14 | Correct | 7 ms | 7416 KB | Output is correct |
15 | Correct | 3 ms | 4992 KB | Output is correct |
16 | Correct | 4 ms | 4172 KB | Output is correct |
17 | Correct | 1 ms | 332 KB | Output is correct |
18 | Correct | 9 ms | 7996 KB | Output is correct |
19 | Correct | 7 ms | 7876 KB | Output is correct |
20 | Correct | 7 ms | 7756 KB | Output is correct |
21 | Correct | 8 ms | 7884 KB | Output is correct |
22 | Correct | 7 ms | 7884 KB | Output is correct |
23 | Correct | 7 ms | 7756 KB | Output is correct |
24 | Correct | 8 ms | 7884 KB | Output is correct |
25 | Correct | 7 ms | 7884 KB | Output is correct |
26 | Correct | 7 ms | 7756 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 1484 KB | Output is correct |
6 | Correct | 2 ms | 1356 KB | Output is correct |
7 | Correct | 1 ms | 1356 KB | Output is correct |
8 | Correct | 2 ms | 1484 KB | Output is correct |
9 | Correct | 1 ms | 1356 KB | Output is correct |
10 | Correct | 2 ms | 1356 KB | Output is correct |
11 | Correct | 1 ms | 1484 KB | Output is correct |
12 | Correct | 1 ms | 1356 KB | Output is correct |
13 | Correct | 1 ms | 1356 KB | Output is correct |
14 | Correct | 7 ms | 7416 KB | Output is correct |
15 | Correct | 3 ms | 4992 KB | Output is correct |
16 | Correct | 4 ms | 4172 KB | Output is correct |
17 | Correct | 1 ms | 332 KB | Output is correct |
18 | Correct | 9 ms | 7996 KB | Output is correct |
19 | Correct | 7 ms | 7876 KB | Output is correct |
20 | Correct | 7 ms | 7756 KB | Output is correct |
21 | Correct | 8 ms | 7884 KB | Output is correct |
22 | Correct | 7 ms | 7884 KB | Output is correct |
23 | Correct | 7 ms | 7756 KB | Output is correct |
24 | Correct | 8 ms | 7884 KB | Output is correct |
25 | Correct | 7 ms | 7884 KB | Output is correct |
26 | Correct | 7 ms | 7756 KB | Output is correct |
27 | Correct | 252 ms | 87968 KB | Output is correct |
28 | Correct | 13 ms | 25932 KB | Output is correct |
29 | Correct | 11 ms | 7756 KB | Output is correct |
30 | Correct | 2 ms | 588 KB | Output is correct |
31 | Correct | 194 ms | 72672 KB | Output is correct |
32 | Correct | 239 ms | 88408 KB | Output is correct |
33 | Correct | 232 ms | 88180 KB | Output is correct |
34 | Correct | 227 ms | 84092 KB | Output is correct |
35 | Correct | 234 ms | 88420 KB | Output is correct |
36 | Correct | 232 ms | 88096 KB | Output is correct |
37 | Correct | 274 ms | 88464 KB | Output is correct |
38 | Correct | 164 ms | 72516 KB | Output is correct |
39 | Correct | 175 ms | 72188 KB | Output is correct |