제출 #1164419

#제출 시각아이디문제언어결과실행 시간메모리
1164419jj_masterBitaro the Brave (JOI19_ho_t1)C++20
50 / 100
1098 ms67208 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int cal_power(int h, int w, vector<vector<int>> &a) { int power = 0; for(int j = 0; j < w; j++) { for(int l = j + 1; l < w; l++) { vector<int> ic(h + 1, 0); for(int r = h - 1; r >= 0; r--) { ic[r] = ic[r + 1]; if(a[r][j] == 2) { ic[r]++; } } for(int i = 0; i < h; i++) { if(a[i][j] == 0 && a[i][l] == 1) { power += ic[i + 1]; } } } } return power; } void sol() { int h, w; cin >> h >> w; vector<vector<int>> a(h, vector<int>(w)); for(int i = 0; i < h; i++) { for(int j = 0; j < w; j++) { char ch; cin >> ch; if(ch == 'J') { a[i][j] = 0; } else if(ch == 'O') { a[i][j] = 1; } else { a[i][j] = 2; } } } int res = cal_power(h, w, a); cout << res << '\n'; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); sol(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...