제출 #247682

#제출 시각아이디문제언어결과실행 시간메모리
247682WhaleVomitBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
176 ms159356 KiB
#include <bits/stdc++.h> using namespace std; #define f first #define s second #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define sz(v) (int)v.size() #define MOO(i, a, b) for(int i=a; i<b; i++) #define M00(i, a) for(int i=0; i<a; i++) #define MOOd(i,a,b) for(int i = (b)-1; i >= a; i--) #define M00d(i,a) for(int i = (a)-1; i>=0; i--) #define FAST ios::sync_with_stdio(0); cin.tie(0); #define finish(x) return cout << x << '\n', 0; #define dbg(x) cerr << ">>> " << #x << " = " << x << "\n"; #define _ << " _ " << template<class T> bool ckmin(T& a, const T& b) {return b < a ? a = b, 1 : 0;} template<class T> bool ckmax(T& a, const T& b) {return a < b ? a = b, 1 : 0;} typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef pair<int,int> pi; typedef pair<ld,ld> pd; typedef complex<ld> cd; const int MAX_N = 3010; int n, m; char arr[MAX_N][MAX_N]; ll icnt[MAX_N][MAX_N]; ll ocnt[MAX_N][MAX_N]; int main() { FAST cin >> n >> m; M00(i, n) { string s; cin >> s; M00(j, m) arr[i][j] = s[j]; } M00d(i, n) { M00(j, m) { if(i == n-1) icnt[i][j] = 0; else icnt[i][j] = ((arr[i+1][j] == 'I') + icnt[i+1][j]); } } M00(i, n) { M00d(j, m) { if(j == m-1) ocnt[i][j] = 0; else ocnt[i][j] = ((arr[i][j+1] == 'O') + ocnt[i][j+1]); } } ll res = 0; M00(i, n) M00(j, m) { if(arr[i][j] == 'J') { res += ocnt[i][j] * icnt[i][j]; } } finish(res); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...