Submission #243982

#TimeUsernameProblemLanguageResultExecution timeMemory
243982uacoder123Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
384 ms88536 KiB
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))
 
typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <lli,ii> iii;
typedef vector <lli> vi;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lli test=1;
  for(;test>0;--test)
  {
    lli h,w,ans=0;
    cin>>h>>w;
    char a[h][w];
    lli b[h][w]={};
    for(lli i=0;i<h;++i)
    {
      for(lli j=0;j<w;++j)
        cin>>a[i][j];
    }
    for(lli i=0;i<h;++i)
    {
      lli c=0;
      for(lli j=w-1;j>=0;--j)
      {
        if(a[i][j]=='O')
          c++;
        else if(a[i][j]=='J')
          b[i][j]=c;
      }
    }
    for(lli j=0;j<w;++j)
    {
      lli c=0;
      for(lli i=h-1;i>=0;--i)
      {
        if(a[i][j]=='I')
          c++;
        else if(a[i][j]=='J')
          b[i][j]*=c;
      }
    }
    for(lli i=0;i<h;++i)
      for(lli j=0;j<w;++j)
        ans+=b[i][j];
      cout<<ans<<endl;
  }
  return(0);
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:55:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for(lli i=0;i<h;++i)
     ^~~
joi2019_ho_t1.cpp:58:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
       cout<<ans<<endl;
       ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...