# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
386778 | 2021-04-07T09:42:20 Z | cpp219 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 273 ms | 159364 KB |
#pragma GCC optimization "Ofast" #pragma GCC optimization "unroll-loop" #pragma GCC target ("avx2") #include <bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second using namespace std; const ll N = 3e3 + 6; const ll Log2 = 19; const ll inf = 1e16 + 7; typedef pair<ll,ll> LL; ll n,m,cntO[N][N],cntI[N][N]; char a[N][N]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); #define task "tst" if (fopen(task".inp", "r")){ freopen(task".inp", "r", stdin); //freopen(task".out", "w", stdout); } cin>>n>>m; for (ll i = 1;i <= n;i++){ for (ll j = 1;j <= m;j++){ cin>>a[i][j]; cntI[i][j] = cntI[i - 1][j] + (a[i][j] == 'I'); cntO[i][j] = cntO[i][j - 1] + (a[i][j] == 'O'); } } ll ans = 0; for (ll i = 1;i <= n;i++){ for (ll j = 1;j <= m;j++) if (a[i][j] == 'J'){ ll p = cntO[i][m] - cntO[i][j - 1],q = cntI[n][j] - cntI[i - 1][j]; ans += p*q; } } cout<<ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 2 ms | 1644 KB | Output is correct |
6 | Correct | 3 ms | 1516 KB | Output is correct |
7 | Correct | 2 ms | 1516 KB | Output is correct |
8 | Correct | 2 ms | 1644 KB | Output is correct |
9 | Correct | 2 ms | 1516 KB | Output is correct |
10 | Correct | 2 ms | 1516 KB | Output is correct |
11 | Correct | 2 ms | 1644 KB | Output is correct |
12 | Correct | 2 ms | 1516 KB | Output is correct |
13 | Correct | 2 ms | 1516 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 2 ms | 1644 KB | Output is correct |
6 | Correct | 3 ms | 1516 KB | Output is correct |
7 | Correct | 2 ms | 1516 KB | Output is correct |
8 | Correct | 2 ms | 1644 KB | Output is correct |
9 | Correct | 2 ms | 1516 KB | Output is correct |
10 | Correct | 2 ms | 1516 KB | Output is correct |
11 | Correct | 2 ms | 1644 KB | Output is correct |
12 | Correct | 2 ms | 1516 KB | Output is correct |
13 | Correct | 2 ms | 1516 KB | Output is correct |
14 | Correct | 10 ms | 8812 KB | Output is correct |
15 | Correct | 4 ms | 5120 KB | Output is correct |
16 | Correct | 6 ms | 5228 KB | Output is correct |
17 | Correct | 1 ms | 492 KB | Output is correct |
18 | Correct | 14 ms | 9708 KB | Output is correct |
19 | Correct | 11 ms | 9580 KB | Output is correct |
20 | Correct | 11 ms | 9580 KB | Output is correct |
21 | Correct | 12 ms | 9964 KB | Output is correct |
22 | Correct | 11 ms | 9836 KB | Output is correct |
23 | Correct | 11 ms | 9836 KB | Output is correct |
24 | Correct | 12 ms | 9964 KB | Output is correct |
25 | Correct | 11 ms | 9836 KB | Output is correct |
26 | Correct | 11 ms | 9836 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 2 ms | 1644 KB | Output is correct |
6 | Correct | 3 ms | 1516 KB | Output is correct |
7 | Correct | 2 ms | 1516 KB | Output is correct |
8 | Correct | 2 ms | 1644 KB | Output is correct |
9 | Correct | 2 ms | 1516 KB | Output is correct |
10 | Correct | 2 ms | 1516 KB | Output is correct |
11 | Correct | 2 ms | 1644 KB | Output is correct |
12 | Correct | 2 ms | 1516 KB | Output is correct |
13 | Correct | 2 ms | 1516 KB | Output is correct |
14 | Correct | 10 ms | 8812 KB | Output is correct |
15 | Correct | 4 ms | 5120 KB | Output is correct |
16 | Correct | 6 ms | 5228 KB | Output is correct |
17 | Correct | 1 ms | 492 KB | Output is correct |
18 | Correct | 14 ms | 9708 KB | Output is correct |
19 | Correct | 11 ms | 9580 KB | Output is correct |
20 | Correct | 11 ms | 9580 KB | Output is correct |
21 | Correct | 12 ms | 9964 KB | Output is correct |
22 | Correct | 11 ms | 9836 KB | Output is correct |
23 | Correct | 11 ms | 9836 KB | Output is correct |
24 | Correct | 12 ms | 9964 KB | Output is correct |
25 | Correct | 11 ms | 9836 KB | Output is correct |
26 | Correct | 11 ms | 9836 KB | Output is correct |
27 | Correct | 262 ms | 158796 KB | Output is correct |
28 | Correct | 17 ms | 26348 KB | Output is correct |
29 | Correct | 19 ms | 13932 KB | Output is correct |
30 | Correct | 2 ms | 876 KB | Output is correct |
31 | Correct | 207 ms | 131436 KB | Output is correct |
32 | Correct | 241 ms | 159364 KB | Output is correct |
33 | Correct | 233 ms | 158700 KB | Output is correct |
34 | Correct | 238 ms | 152428 KB | Output is correct |
35 | Correct | 240 ms | 159084 KB | Output is correct |
36 | Correct | 233 ms | 158700 KB | Output is correct |
37 | Correct | 273 ms | 159212 KB | Output is correct |
38 | Correct | 179 ms | 130924 KB | Output is correct |
39 | Correct | 174 ms | 130924 KB | Output is correct |