Submission #361756

#TimeUsernameProblemLanguageResultExecution timeMemory
361756l3nl3Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
383 ms88428 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define int long long #define exit exit(false) #define pause system("PAUSE") //#define here() cerr << "herewego\n"; #define showe(x) cerr << #x << ": " << x << '\n' #define shows(x) cerr << #x << ": " << x << ", " #define ioio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; //using namespace __gnu_pbds; //typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; signed main () { ioio(); int n, m; cin >> n >> m; char a[n+1][m+1]; int cn[n+1][m+1], ans = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]; cn[i][j] = 0; } } for (int i = 1; i <= n; i++) { int O = 0; for (int j = m; j >= 1; j--) { if (a[i][j] == 'J') { cn[i][j] = O; } else if (a[i][j] == 'O') { O++; } } } for (int j = 1; j <= m; j++) { int I = 0; for (int i = n; i >= 1; i--) { if (a[i][j] == 'J') { ans += (I * cn[i][j]); } else if (a[i][j] == 'I') { I++; } } } cout << ans; // cerr << "\nTime elapsed: " << (clock() + 0.0) / CLOCKS_PER_SEC; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...