Submission #1024984

#TimeUsernameProblemLanguageResultExecution timeMemory
1024984vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
113 ms19284 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pii pair<int, int> #define pll pair<ll, ll> #define pld pair<ld, ld> #define pb push_back #define fi first #define se second #define debug(x) cout << #x << " => " << x << endl #define all(x) x.begin(),x.end() int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,m;cin>>n>>m; string s[n]; for(int i=0;i<n;i++) cin>>s[i]; ll O[n],I[m]; memset(O,0,sizeof(O)); memset(I,0,sizeof(I)); for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { if(s[i][j]=='O') O[i]++; if(s[i][j]=='I') I[j]++; } } ll ans=0; for(int i=0;i<n;i++) for(int j=0;j<m;j++) { if(s[i][j]=='J') ans+=(O[i]*I[j]); if(s[i][j]=='O') O[i]--; if(s[i][j]=='I') I[j]--; } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...