Submission #795993

#TimeUsernameProblemLanguageResultExecution timeMemory
795993vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
50 / 100
238 ms274432 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][3], b[3005][3005][3]; 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][1]=a[i][j+1][1]; if(c[i][j]=='O') a[i][j][1]++; } } for(ll j = 1; j <= m; j++){ for(ll i = n; i >= 1; i--){ b[i][j][2]=b[i+1][j][2]; if(c[i][j]=='I') b[i][j][2]++; } } for(ll i = 1; i <= n; i++){ for(ll j = 1; j <= m; j++){ if(c[i][j]=='J')s+=(a[i][j][1]*b[i][j][2]); } } cout << s; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...