Submission #826811

#TimeUsernameProblemLanguageResultExecution timeMemory
826811LeVanThucBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
151 ms159472 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define p(x,y) pair<ll,ll>(x,y) #define BIT(i,x) ((x>>i)&1) #define MASK(x) (1<<x) #define ld long double #define __builtin_popcount __builtin_popcountll #define pll pair<ll,ll> template<class T1,class T2> bool maximize(T1 &x,const T2 &y) { if(x<y) { x=y; return 1; } return 0; } template<class T1,class T2> bool minimize(T1 &x,const T2 &y) { if(x>y) { x=y; return 1; } return 0; } void online() { std::ios_base::sync_with_stdio(0); cin.tie(0); } const ll N=3e3+10; string s[N]; ll Or[N][N],Jr[N][N],n,m,ans; int main() { online(); cin>>n>>m; for(int i=1;i<=n;i++) { cin>>s[i]; s[i]=' '+s[i]; for(int j=m;j>=1;j--) { if(s[i][j]=='O') Or[i][j]++; Or[i][j]+=Or[i][j+1]; if(s[i][j]=='J') { Jr[i][j]+=Or[i][j]; } Jr[i][j]+=Jr[i-1][j]; if(s[i][j]=='I') ans+=Jr[i][j]; } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...