Submission #1169525

#TimeUsernameProblemLanguageResultExecution timeMemory
1169525rayan_bdBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
255 ms150516 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; #define getar(ar,n) for(ll i=0;i<n;++i) cin>>ar[i] #define show(n) cout<<n<<'\n' #define all(v) v.begin(), v.end() #define br cout<<"\n" #define pb push_back #define nl '\n' #define yes cout<<"YES\n" #define no cout<<"NO\n" #define ret return #define ll long long #define ld long double #define sza(x) ((int)x.size()) #define fi first #define se second const int mxN = 3005; const ll MOD = 1e9 + 7; const ll INF = 1e9; const ld EPS = 1e-9; char grid[mxN][mxN]; ll row_sum[mxN][mxN],col_sum[mxN][mxN]; void lets_go() { ll n,m,ans=0;cin>>n>>m; for(ll i=1;i<=n;++i){ string str;cin>>str; for(ll j=1;j<=m;++j){ grid[i][j]=str[j-1]; } } for(ll i=1;i<=n;++i){ for(ll j=m;j>=1;--j){ row_sum[i][j]=row_sum[i][j+1]+(grid[i][j]=='O'); } } for(ll j=1;j<=m;++j){ for(ll i=n;i>=1;--i){ col_sum[i][j]=col_sum[i+1][j]+(grid[i][j]=='I'); } } for(ll i=1;i<=n;++i){ for(ll j=1;j<=m;++j){ if(grid[i][j]=='J') ans+=col_sum[i][j]*row_sum[i][j]; } } show(ans); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); lets_go(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...