Submission #110332

#TimeUsernameProblemLanguageResultExecution timeMemory
110332sofhiasouzaBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
915 ms79992 KiB
#include <bits/stdc++.h> #define MAXN 3010 using namespace std; int h, w, qorb[MAXN][MAXN], qing[MAXN][MAXN]; char s[MAXN][MAXN]; int main() { cin >> h >> w; for(int i = 1 ; i <= h ; i++) { for(int j = 1 ; j <= w ; j++) { cin >> s[i][j]; qorb[i][j] = qorb[i][j-1]; if(s[i][j] == 'O') qorb[i][j]++; } } for(int j = 1 ; j <= w ; j++) { for(int i = 1 ; i <= h ; i++) { qing[i][j] = qing[i-1][j]; if(s[i][j] == 'I') qing[i][j]++; } } long long int sum = 0; for(int i = 1 ; i <= h ; i++) { for(int j = 1 ; j <= w ; j++) { if(s[i][j] == 'J') { long long int v = (qorb[i][w] - qorb[i][j])*(qing[h][j] - qing[i][j]); sum += v; } } } cout << sum << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...