Submission #753895

# Submission time Handle Problem Language Result Execution time Memory
753895 2023-06-06T09:36:05 Z emad234 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
365 ms 159416 KB
#include <bits/stdc++.h>
#define all(v) ((v).begin(),(v).end())
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;
const ll mxN = 2e6 + 1;
char a[3011][3011];
ll ing[3011][3011],orb[3011][3011];
signed main()
{
  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  ll n,m;
  cin >>n>>m;
  for(ll i = 1;i <= n;i++){
    for(ll j = 1; j <= m;j++){
      cin >>a[i][j];
    }
  }
  for(ll j = 1;j <= m;j++){
    for(ll i = n;i;i--){
      ing[i][j] = ing[i + 1][j] + (a[i][j] == 'I');
    }
  }
  for(ll i = 1;i <= n;i++){
    for(ll j = m;j;j--){
      orb[i][j] = orb[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'){
        ans += orb[i][j] * ing[i][j];
      }
    }
  }
  cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1472 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1472 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 9 ms 9024 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 6 ms 5316 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 11 ms 9896 KB Output is correct
19 Correct 11 ms 9820 KB Output is correct
20 Correct 10 ms 9684 KB Output is correct
21 Correct 11 ms 9944 KB Output is correct
22 Correct 10 ms 9812 KB Output is correct
23 Correct 10 ms 9684 KB Output is correct
24 Correct 11 ms 9936 KB Output is correct
25 Correct 10 ms 9812 KB Output is correct
26 Correct 9 ms 9684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1472 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 9 ms 9024 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 6 ms 5316 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 11 ms 9896 KB Output is correct
19 Correct 11 ms 9820 KB Output is correct
20 Correct 10 ms 9684 KB Output is correct
21 Correct 11 ms 9944 KB Output is correct
22 Correct 10 ms 9812 KB Output is correct
23 Correct 10 ms 9684 KB Output is correct
24 Correct 11 ms 9936 KB Output is correct
25 Correct 10 ms 9812 KB Output is correct
26 Correct 9 ms 9684 KB Output is correct
27 Correct 347 ms 158872 KB Output is correct
28 Correct 13 ms 26452 KB Output is correct
29 Correct 19 ms 13928 KB Output is correct
30 Correct 1 ms 724 KB Output is correct
31 Correct 274 ms 131612 KB Output is correct
32 Correct 348 ms 159272 KB Output is correct
33 Correct 350 ms 158884 KB Output is correct
34 Correct 344 ms 152648 KB Output is correct
35 Correct 363 ms 159264 KB Output is correct
36 Correct 353 ms 158772 KB Output is correct
37 Correct 365 ms 159416 KB Output is correct
38 Correct 239 ms 130764 KB Output is correct
39 Correct 236 ms 131100 KB Output is correct