Submission #1118070

#TimeUsernameProblemLanguageResultExecution timeMemory
1118070vjudge1Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
225 ms17992 KiB
#include <bits/stdc++.h> #define sts(v) stable_sort(v.BE, v.E) #define Rsts(v) stable_sort(v.rBE, v.rE) #define rev(v) reverse(v.BE, v.E) #define BE begin() #define rBE rbegin() #define E end() #define rE rend() #define pb push_back #define ppb pop_back() #define pf push_front #define ppf pop_front() #define F first #define S second using namespace std; using ll = long long; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; vector<int> cnt_O(n + 1), cnt_I(m + 1); char v[n + 1][m + 1]; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ char c; cin >> c; v[i][j] = c; if(c == 'O')cnt_O[i]++; if(c == 'I')cnt_I[j]++; } } ll ans = 0; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ char c = v[i][j]; if(c == 'J')ans += cnt_O[i] * cnt_I[j]; else if(c == 'O')cnt_O[i]--; else cnt_I[j]--; } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...