Submission #319507

#TimeUsernameProblemLanguageResultExecution timeMemory
319507mariowongBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
398 ms159204 KiB
#include <bits/stdc++.h> #define x first #define y second #define pii pair<int,int> #define ll long long #define pll pair<ll,ll> #define pbb pair<bool,bool> #define mp make_pair #define pb push_back #define pf push_front #define popb pop_back #define popf pop_front #define xmod (ll)(1e9+9) #define hmod 1286031825167LL using namespace std; ll ans,n,m,ps_o[3005][3005],ps_i[3005][3005]; char s[3005][3005]; int main(){ ios::sync_with_stdio(false); cin >> n >> m; for (int i=1;i<=n;i++){ for (int j=1;j<=m;j++){ cin >> s[i][j]; ps_o[i][j]=ps_o[i][j-1]; ps_i[i][j]=ps_i[i-1][j]; if (s[i][j] == 'O') ps_o[i][j]++; if (s[i][j] == 'I') ps_i[i][j]++; } } for (int i=1;i<=n;i++){ for (int j=1;j<=m;j++){ if (s[i][j] == 'J') ans+=(ps_o[i][m]-ps_o[i][j])*(ps_i[n][j]-ps_i[i][j]); } } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...