Submission #167351

# Submission time Handle Problem Language Result Execution time Memory
167351 2019-12-07T14:42:19 Z theStaticMind Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
485 ms 154360 KB
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
   //   freopen("q.gir","r",stdin);
   //   freopen("q.cik","w",stdout);
      int n,m,ans=0;
      cin>>n>>m;
      vector<string>s(n);
      vector<vector<int>>O(n,vector<int>(m+1,0)),I(n+1,vector<int>(m,0));
      for(int i=0;i<n;i++){
            cin>>s[i];
      }
      for(int i=0;i<n;i++){
            for(int j=m-1;j>=0;j--){
                  O[i][j]=O[i][j+1]+(s[i][j]=='O'?1:0);
            }
      }
      for(int j=0;j<m;j++){
            for(int i=n-1;i>=0;i--){
                  I[i][j]=I[i+1][j]+(s[i][j]=='I'?1:0);
            }
      }
      for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                  if(s[i][j]=='J'){
                        ans+=O[i][j]*I[i][j];
                  }
            }
      }
      cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 504 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 504 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 9 ms 3832 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 6 ms 2680 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 9 ms 4856 KB Output is correct
19 Correct 9 ms 4600 KB Output is correct
20 Correct 10 ms 4756 KB Output is correct
21 Correct 10 ms 4856 KB Output is correct
22 Correct 9 ms 4600 KB Output is correct
23 Correct 9 ms 4728 KB Output is correct
24 Correct 10 ms 4856 KB Output is correct
25 Correct 8 ms 4600 KB Output is correct
26 Correct 8 ms 4728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 504 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 9 ms 3832 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 6 ms 2680 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 9 ms 4856 KB Output is correct
19 Correct 9 ms 4600 KB Output is correct
20 Correct 10 ms 4756 KB Output is correct
21 Correct 10 ms 4856 KB Output is correct
22 Correct 9 ms 4600 KB Output is correct
23 Correct 9 ms 4728 KB Output is correct
24 Correct 10 ms 4856 KB Output is correct
25 Correct 8 ms 4600 KB Output is correct
26 Correct 8 ms 4728 KB Output is correct
27 Correct 419 ms 146140 KB Output is correct
28 Correct 4 ms 1016 KB Output is correct
29 Correct 19 ms 11768 KB Output is correct
30 Correct 3 ms 760 KB Output is correct
31 Correct 300 ms 108508 KB Output is correct
32 Correct 418 ms 153440 KB Output is correct
33 Correct 416 ms 153848 KB Output is correct
34 Correct 359 ms 125276 KB Output is correct
35 Correct 418 ms 153412 KB Output is correct
36 Correct 422 ms 153848 KB Output is correct
37 Correct 485 ms 154360 KB Output is correct
38 Correct 276 ms 107892 KB Output is correct
39 Correct 276 ms 108488 KB Output is correct