Submission #1270367

#TimeUsernameProblemLanguageResultExecution timeMemory
1270367george_rubioBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
315 ms150576 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define vi vector<int> #define vb vector<bool> #define vpi vector<pii> #define MOD 1000000007 #define INF (int)2e18 #define mod(x) (((x)%MOD+MOD)%MOD) #define MAX 200005 signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; vector<vi> a(n+1, vi(m+1)); vector<vi> b(n+1, vi(m+1)); vector<vector<char>> c(n+1, vector<char>(m+1)); for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cin >> c[i][j]; if(c[i][j] == 'O') a[i][j]++; else if(c[i][j] == 'I') b[i][j]++; } } for(int i = 0; i < n; i++){ for(int j = m-2; j >= 0; j--){ a[i][j] += a[i][j+1]; } } for(int j = 0; j < m; j++){ for(int i = n-2; i >= 0; i--){ b[i][j] += b[i+1][j]; } } int ans = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ if(c[i][j] == 'J'){ ans += a[i][j] * b[i][j]; } } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...