# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
210480 | 2020-03-17T13:46:25 Z | gratus907 | Bitaro the Brave (JOI19_ho_t1) | C++17 | 268 ms | 153976 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define all(x) ((x).begin()),((x).end()) #define int ll using pii = pair<int, int>; #define INF 0x7f7f7f7f7f7f7f7f const bool debug = false; char arrange[3030][3030]; int orb[3030][3030]; int ingot[3030][3030]; int h, w; int32_t main() { scanf("%lld %lld",&h, &w); for (int i = 1; i<=h; i++) scanf("%s",arrange[i]+1); for (int i = 1; i<=h; i++) { for (int j = 1; j<=w; j++) { if (arrange[i][j]=='O') orb[i][j]++; else if (arrange[i][j]=='I') ingot[i][j]++; } } for (int i = 1; i<=h; i++) for (int j = w-1; j>=1; j--) orb[i][j] += orb[i][j+1]; for (int i = 1; i<=w; i++) for (int j = h-1; j>=1; j--) ingot[j][i] += ingot[j+1][i]; int ans = 0; for (int i = 1; i<=h; i++) for (int j = 1; j<=w; j++) if (arrange[i][j]=='J') ans += orb[i][j+1]*ingot[i+1][j]; printf("%lld\n",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 6 ms | 1656 KB | Output is correct |
6 | Correct | 6 ms | 1528 KB | Output is correct |
7 | Correct | 5 ms | 1528 KB | Output is correct |
8 | Correct | 6 ms | 1656 KB | Output is correct |
9 | Correct | 6 ms | 1528 KB | Output is correct |
10 | Correct | 5 ms | 1400 KB | Output is correct |
11 | Correct | 6 ms | 1528 KB | Output is correct |
12 | Correct | 6 ms | 1528 KB | Output is correct |
13 | Correct | 5 ms | 1528 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 6 ms | 1656 KB | Output is correct |
6 | Correct | 6 ms | 1528 KB | Output is correct |
7 | Correct | 5 ms | 1528 KB | Output is correct |
8 | Correct | 6 ms | 1656 KB | Output is correct |
9 | Correct | 6 ms | 1528 KB | Output is correct |
10 | Correct | 5 ms | 1400 KB | Output is correct |
11 | Correct | 6 ms | 1528 KB | Output is correct |
12 | Correct | 6 ms | 1528 KB | Output is correct |
13 | Correct | 5 ms | 1528 KB | Output is correct |
14 | Correct | 13 ms | 8956 KB | Output is correct |
15 | Correct | 7 ms | 5112 KB | Output is correct |
16 | Correct | 10 ms | 5368 KB | Output is correct |
17 | Correct | 5 ms | 504 KB | Output is correct |
18 | Correct | 15 ms | 9952 KB | Output is correct |
19 | Correct | 14 ms | 9848 KB | Output is correct |
20 | Correct | 14 ms | 9848 KB | Output is correct |
21 | Correct | 15 ms | 9976 KB | Output is correct |
22 | Correct | 15 ms | 9848 KB | Output is correct |
23 | Correct | 14 ms | 9848 KB | Output is correct |
24 | Correct | 15 ms | 9976 KB | Output is correct |
25 | Correct | 14 ms | 9848 KB | Output is correct |
26 | Correct | 14 ms | 9848 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 6 ms | 1656 KB | Output is correct |
6 | Correct | 6 ms | 1528 KB | Output is correct |
7 | Correct | 5 ms | 1528 KB | Output is correct |
8 | Correct | 6 ms | 1656 KB | Output is correct |
9 | Correct | 6 ms | 1528 KB | Output is correct |
10 | Correct | 5 ms | 1400 KB | Output is correct |
11 | Correct | 6 ms | 1528 KB | Output is correct |
12 | Correct | 6 ms | 1528 KB | Output is correct |
13 | Correct | 5 ms | 1528 KB | Output is correct |
14 | Correct | 13 ms | 8956 KB | Output is correct |
15 | Correct | 7 ms | 5112 KB | Output is correct |
16 | Correct | 10 ms | 5368 KB | Output is correct |
17 | Correct | 5 ms | 504 KB | Output is correct |
18 | Correct | 15 ms | 9952 KB | Output is correct |
19 | Correct | 14 ms | 9848 KB | Output is correct |
20 | Correct | 14 ms | 9848 KB | Output is correct |
21 | Correct | 15 ms | 9976 KB | Output is correct |
22 | Correct | 15 ms | 9848 KB | Output is correct |
23 | Correct | 14 ms | 9848 KB | Output is correct |
24 | Correct | 15 ms | 9976 KB | Output is correct |
25 | Correct | 14 ms | 9848 KB | Output is correct |
26 | Correct | 14 ms | 9848 KB | Output is correct |
27 | Correct | 250 ms | 153976 KB | Output is correct |
28 | Correct | 19 ms | 26360 KB | Output is correct |
29 | Correct | 21 ms | 13944 KB | Output is correct |
30 | Correct | 5 ms | 888 KB | Output is correct |
31 | Correct | 196 ms | 128096 KB | Output is correct |
32 | Correct | 241 ms | 153976 KB | Output is correct |
33 | Correct | 236 ms | 153464 KB | Output is correct |
34 | Correct | 225 ms | 148088 KB | Output is correct |
35 | Correct | 248 ms | 153848 KB | Output is correct |
36 | Correct | 245 ms | 153336 KB | Output is correct |
37 | Correct | 268 ms | 153848 KB | Output is correct |
38 | Correct | 191 ms | 127096 KB | Output is correct |
39 | Correct | 181 ms | 127356 KB | Output is correct |