Submission #1262104

#TimeUsernameProblemLanguageResultExecution timeMemory
1262104islam_2010Bitaro the Brave (JOI19_ho_t1)C++20
20 / 100
18 ms3140 KiB
#include <bits/stdc++.h> using namespace std; int n, m; const int sz = 3005; char a[sz][sz]; vector<int> v[sz]; vector<int> w[sz]; signed main(){ cin >> n >> m; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cin >> a[i][j]; if(a[i][j] == 'O'){ v[i].push_back(j); }if(a[i][j] == 'I'){ w[j].push_back(i); } } }int ans = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ if(a[i][j] == 'J'){ int x = v[i].end() - upper_bound(v[i].begin(), v[i].end(), j); int y = w[j].end() - upper_bound(w[j].begin(), w[j].end(), i); ans += 1ll * x * y; } } }cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...