Submission #916519

#TimeUsernameProblemLanguageResultExecution timeMemory
916519viwlesxqBitaro the Brave (JOI19_ho_t1)C++17
50 / 100
1044 ms84304 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() #define size(x) (int)x.size() template<class S, class T> bool chmin(S &a, const T &b) { return a > b && (a = b) == b; } template<class S, class T> bool chmax(S &a, const T &b) { return a < b && (a = b) == b; } const int inf = 1e9 + 7; const int INF = 1e18 + 7; const int mod = 1e9 + 7; signed main() { cin.tie(nullptr)->sync_with_stdio(false); int n, m; cin >> n >> m; string s[n]; for (int i = 0; i < n; ++i) cin >> s[i]; int pref[n][m]; for (int i = 0; i < n; ++i) { pref[i][0] = s[i][0] == 'O'; for (int j = 1; j < m; ++j) { pref[i][j] = pref[i][j - 1] + (s[i][j] == 'O'); } } int res = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { for (int k = i + 1; k < n; ++k) { if (s[i][j] == 'J' && s[k][j] == 'I') { res += pref[i][m - 1] - pref[i][j]; } } } } cout << res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...