Submission #207826

# Submission time Handle Problem Language Result Execution time Memory
207826 2020-03-09T07:45:30 Z kai824 Bitaro the Brave (JOI19_ho_t1) C++17
0 / 100
5 ms 504 KB
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

string mp[3005];

ll i_cnt[3005][3005];
ll o_cnt[3005][3005],ans;

int32_t main() {
    ios_base::sync_with_stdio(false);cin.tie(0);
    int h,w;
    cin>>h>>w;
    for(int x=0;x<h;x++){
      cin>>mp[x];
    }
    for(int x=0;x<h;x++){
      if(mp[x][w-1]=='o')o_cnt[x][w-1]++;
      for(int i=w-2;i>=0;i--){
        o_cnt[x][i]=o_cnt[x][i+1];
        if(mp[x][i]=='O')o_cnt[x][i]++;
      }
    }
    for(int x=0;x<w;x++){
      for(int i=h-1;i>=0;i--){
        i_cnt[i][x]=i_cnt[i+1][x];
        if(mp[i][x]=='I')i_cnt[i][x]++;
      }
    }
    for(int x=0;x<h;x++){
      for(int y=0;y<w;y++){
        ans+=o_cnt[x][y+1]*i_cnt[x+1][y];
      }
    }
    cout<<ans<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 504 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 504 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 504 KB Output isn't correct
3 Halted 0 ms 0 KB -