Submission #1122671

#TimeUsernameProblemLanguageResultExecution timeMemory
1122671SulABitaro the Brave (JOI19_ho_t1)C++20
100 / 100
75 ms10216 KiB
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> //#pragma GCC target("popcnt") using namespace __gnu_pbds; using namespace std; using ordered_set = tree<int, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update>; #define popcount __builtin_popcountll signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n,m; cin >> n >> m; string a[n]; for (auto& s : a) cin >> s; long long ans = 0; int row[n]{}, col[m]{}; for (int i = n-1; i >= 0; i--) { for (int j = m-1; j >= 0; j--) { if (a[i][j] == 'J') ans += row[i] * col[j]; else if (a[i][j] == 'O') row[i]++; else col[j]++; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...