이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define endl "\n"
#define pii pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define pque priority_queue
#define pqueg priority_queue<ll,vector<ll>,greater<ll>>
#define que queue<ll>
#define FOR(m,i,n) for(int i=(m); i<=(n); i++)
#define FORM(m,i,n) for(int i=(m); i>=(n); i--)
#define all(v) sort(v.begin(),v.end())
ll h,w;
ll ans;
char grid[3030][3030];
ll prefi[3030][3030],prefo[3030][3030];
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> h >> w;
	FOR(1,i,h) {
		FOR(1,j,w) {
			cin >> grid[i][j];
			prefo[i][j] = prefo[i][j-1];
			prefi[i][j] = prefi[i-1][j];
			if(grid[i][j] == 'O') {
				prefo[i][j]++;
			}
			else if(grid[i][j] == 'I') {
				prefi[i][j]++;
			}
		}
	}
	FOR(1,i,h) {
		FOR(1,j,w) {
			if(grid[i][j] == 'J') {
				ans += (prefo[i][w] - prefo[i][j]) * (prefi[h][j] - prefi[i][j]);
			}
		}
	}
	cout << ans << endl;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |