Submission #879596

#TimeUsernameProblemLanguageResultExecution timeMemory
879596iskhakkutbilimBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
148 ms18260 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define all(a) a.begin(), a.end() const int mod = 1e9 + 7; const int N = 3000; int n, m; char a[N][N]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for(int i = 0;i < n; i++){ for(int j = 0;j < m; j++){ cin >> a[i][j]; } } vector<int> col_I(m, 0); for(int j = 0;j < m; j++){ for(int i = 0;i < n; i++){ col_I[j]+= (a[i][j] == 'I'); } } vector<int> row_O(n, 0); for(int i = 0; i < n; i++){ for(int j = 0;j < m; j++) row_O[i]+= (a[i][j] == 'O'); } int ans = 0; for(int i = 0;i < n; i++){ for(int j = 0;j < m; j++){ col_I[j]-= (a[i][j] == 'I'); row_O[i]-= (a[i][j] == 'O'); if(a[i][j] == 'J'){ int I = col_I[j]; int O = row_O[i]; // cout << i+1 << ' ' << j+1 << " = " << I << '\n'; //cout << i+1 << ' ' << j+1 << " = " << O << '\n'; ans+= O*I; } } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...