Submission #685267

#TimeUsernameProblemLanguageResultExecution timeMemory
685267YENGOYANBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
166 ms19032 KiB
/* //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\ \\ // // 271828___182845__904523__53602__ \\ \\ 87___47____13______52____66__24_ // // 97___75____72______47____09___36 \\ \\ 999595_____74______96____69___67 // // 62___77____24______07____66__30_ \\ \\ 35___35____47______59____45713__ // // \\ \\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\// */ #include <iostream> #include <vector> #include <set> #include <map> #include <unordered_map> #include <unordered_set> #include <cmath> #include <climits> #include <algorithm> #include <random> #include <queue> #include <deque> #include <iomanip> #include <string> #include <tuple> #include <bitset> #include <chrono> #include <ctime> #include <fstream> #include <stack> #include <cstdio> using namespace std; using ll = long long; const int N = 3e5 + 5; const ll mod = 1e9 + 7, inf = 1e18; void solve() { int n, m; cin >> n >> m; vector<string> v(n); for (int i = 0; i < n; ++i) cin >> v[i]; vector<ll> cnt_o(n), cnt_i(m); for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (v[i][j] == 'O') ++cnt_o[i]; } } for (int j = 0; j < m; ++j) { for (int i = 0; i < n; ++i) { if (v[i][j] == 'I') ++cnt_i[j]; } } ll ans = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (v[i][j] == 'J') { ans += cnt_i[j] * cnt_o[i]; } else if (v[i][j] == 'O') --cnt_o[i]; else --cnt_i[j]; } } cout << ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); //int t; cin >> t; //while (t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...