Submission #947617

#TimeUsernameProblemLanguageResultExecution timeMemory
947617KongggwpBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
254 ms154940 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int int n , m , ao[3005][3005] , ai[3005][3005] , sum; char a[3005][3005] ; int32_t main() { ios_base::sync_with_stdio(0);cin.tie(0); cin >> n >> m; for(int i=0 ; i<n ; i++) { for(int j=0 ; j<m ; j++) { cin >> a[i][j]; if(a[i][j]=='O')ao[i][j]++; if(a[i][j]=='I')ai[i][j]++; } } for(int i=n-1 ; i>=0 ; i--)for(int j=m-1 ; j>=0 ; j--)ao[i][j]+=ao[i][j+1] , ai[i][j]+=ai[i+1][j]; for(int i=n-1 ; i>=0 ; i--)for(int j=m-1 ; j>=0 ; j--)if(a[i][j]=='J')sum += ao[i][j] * ai[i][j]; cout << sum; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...