Submission #1262105

#TimeUsernameProblemLanguageResultExecution timeMemory
1262105islam_2010Bitaro the Brave (JOI19_ho_t1)C++20
20 / 100
18 ms3144 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].size() - (upper_bound(v[i].begin(), v[i].end(), j) - v[i].begin()); int y = w[j].size() - (upper_bound(w[j].begin(), w[j].end(), i) - w[j].begin()); 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...