Submission #795994

#TimeUsernameProblemLanguageResultExecution timeMemory
795994vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
335 ms159104 KiB
// Problem: B - Bitaro the Brave // Contest: Virtual Judge - THT - Day 14 // URL: https://vjudge.net/contest/571691#problem/B // Memory Limit: 268 MB // Time Limit: 1000 ms #include <bits/stdc++.h> #define ll long long #define sp << " " #define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) using namespace std; ll n, m, k, t, s; char c[3005][3005]; ll a[3005][3005], b[3005][3005]; int main(){ faster; cin >> n >> m; for(ll i = 1; i <= n; i++){ for(ll j = 1; j <= m; j++) cin >> c[i][j]; } for(ll i = 1; i <= n; i++){ for(ll j = m; j >= 1; j--){ a[i][j]=a[i][j+1]; if(c[i][j]=='O') a[i][j]++; } } for(ll j = 1; j <= m; j++){ for(ll i = n; i >= 1; i--){ b[i][j]=b[i+1][j]; if(c[i][j]=='I') b[i][j]++; } } for(ll i = 1; i <= n; i++){ for(ll j = 1; j <= m; j++){ if(c[i][j]=='J')s+=(a[i][j]*b[i][j]); } } cout << s; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...