Submission #492735

# Submission time Handle Problem Language Result Execution time Memory
492735 2021-12-08T16:03:55 Z niloyroot Bitaro the Brave (JOI19_ho_t1) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pl = pair<ll,ll>;
#define pb push_back
#define form(m,it) for(auto it=m.begin(); it!=m.end(); it++)
#define forp(i,a,b) for(ll i=a; i<=b; i++)
#define forn(i,a,b) for(ll i=a; i>=b; i--)
#define newl '\n'
#define ff first
#define ss second
const ll mod = 1000000007;
ll cr[3][3005][3005];
ll cc[3][3005][3005];
ll a[3005][3005];

void solve(){
    ll h,w; cin>>h>>w;
    forp(i,1,h){
        forp(j,1,w){
            cin>>c;
            if(c=='J'){
              a[i][j]=0;
            }
          	if(c=='O'){
              a[i][j]=1;
            }
          	if(c=='I'){
              a[i][j]=2;
            }
        }
    }
    forp(i,1,h){
        forp(j,1,w){
            forp(k,0,2){
                cr[k][i][j]=cr[k][i][j-1]+(a[i][j]==k);
            }
        }
    }
    forp(i,1,h){
        forp(j,1,w){
            forp(k,0,2){
                cc[k][i][j]=cc[k][i-1][j]+(a[i][j]==k);
            }
        }
    }

    ll ans=0;
    forp(i,1,h){
        forp(j,1,w){
            if(a[i][j]==0){
                ans+=(cr[1][i][w]-cr[1][i][j-1])*(cc[2][h][j]-cc[2][i-1][j]);
            }
        }
    }

    cout<<ans<<newl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1; //cin>>t;
    while(t--)solve();
}

Compilation message

joi2019_ho_t1.cpp: In function 'void solve()':
joi2019_ho_t1.cpp:22:18: error: 'c' was not declared in this scope
   22 |             cin>>c;
      |                  ^