Submission #220392

#TimeUsernameProblemLanguageResultExecution timeMemory
220392hanagasumiBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
190 ms17916 KiB
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <deque> #include <map> #include <set> #include <complex> #include <string> #include <unordered_map> #include <unordered_set> #include <random> #define ft first #define sc second #define pb push_back #define len(v) (int)v.size() #define int ll using namespace std; typedef long long ll; signed main() { #ifdef PC freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int h, w; cin >> h >> w; vector<vector<char>> mat(h, vector<char>(w)); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> mat[i][j]; } } int ans = 0; vector<int> have(w, 0); for (int i = h - 1; i >= 0; i--) { int now = 0; for (int j = w - 1; j >= 0; j--) { if(mat[i][j] == 'I') have[j]++; if(mat[i][j] == 'O') now++; if(mat[i][j] == 'J') { ans += have[j] * now; } } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...