제출 #171987

#제출 시각아이디문제언어결과실행 시간메모리
171987cheissmartBitaro the Brave (JOI19_ho_t1)C++14
0 / 100
2 ms504 KiB
#include <bits/stdc++.h> #define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0); #define F first #define S second #define V vector #define PB push_back #define MP make_pair #define EB emplace_back #define ALL(v) (v).begin(), (v).end() #define debug(x) cerr << #x << " is " << x << endl using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7; char a[3003][3003]; int I[3003][3003], O[3003][3003]; signed main() { IO_OP; int n, m; cin >> n >> m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin >> a[i][j]; ll ans = 0; for(int i=1;i<=n;i++) for(int j=m;j>=1;j--) O[i][j] = O[i][j+1] + (a[i][j] == 'O'); for(int j=1;j<=m;j++) for(int i=m;i>=1;i--) I[i][j] = I[i+1][j] + (a[i][j] == 'I'); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(a[i][j] == 'J') ans += (ll) O[i][j] * I[i][j]; cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...