Submission #857714

#TimeUsernameProblemLanguageResultExecution timeMemory
857714yusufhocaogluBitaro the Brave (JOI19_ho_t1)C++17
20 / 100
7 ms2752 KiB
#include <iostream> #include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define MOD2 998244353 #define ll long long #define pri pair<int,int> #define prl pair<ll,ll> #define vi vector<int> #define vl vector<ll> #define vp vector<pair<int,int>> #define vpl vector<pair<ll,ll>> #define re return 0 #define sqrt sqrtl int32_t main() { int h,w;cin>>h>>w; vector<vector<int>> no(h,vector<int>(w)); vector<vector<int>> ni(w,vector<int>(h)); vector<string> grid(h); for (int i = 0;i<h;i++) { string s;cin>>s; for (int j = 0;j<w;j++) { if (j==0) no[i][j] = (s[j]=='O'); else no[i][j] = no[i][j-1] + (s[j]=='O'); if (i==0) ni[j][i] = (s[j]=='I'); else ni[j][i] = ni[j][i-1]+(s[j]=='I'); } grid[i] = s; } int s = 0; for (int i = 0;i<h;i++) { for (int j = 0;j<w;j++) { if (grid[i][j]!='J') continue; s+= (no[i][w-1] - no[i][j]) * (ni[j][h-1] - ni[j][i]); //cout<<no[i][j]<<" "; }//cout<<endl; } cout<<s<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...