이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define int long long
#define N 200005
#define pii pair<int, int>
#define piii pair<int, pii>
using namespace std;
int n, m, i, j, d[3003][3003], r[3003][3003], ans;
char a[3003][3003];
main()
{
std::ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for(i = 0; i < n; i++)
for(j = 0; j < m; j++)
cin >> a[i][j];
for(i = n - 1; i >= 0; i--)
for(j = m - 1; j >= 0; j--)
{
if(j == m - 1) r[i][j] = 0;
else if(a[i][j + 1] == 'O') r[i][j] = r[i][j + 1] + 1;
else r[i][j] = r[i][j + 1];
if(i == n - 1) d[i][j] = 0;
else if(a[i + 1][j] == 'I') d[i][j] = d[i + 1][j] + 1;
else d[i][j] = d[i + 1][j];
if(a[i][j] == 'J') ans += r[i][j] * d[i][j];
}
cout << ans << '\n';
}
컴파일 시 표준 에러 (stderr) 메시지
joi2019_ho_t1.cpp:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
14 | main()
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |