# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1258714 | thethao2202 | Bitaro the Brave (JOI19_ho_t1) | C++20 | 7 ms | 7752 KiB |
#include <bits/stdc++.h>
using namespace std;
int h, w, tong = 0;
char s[3005][3005];
int a[3005][3005], b[3005][3005], c[3005][3005];
main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> h >> w;
for (int i = 1; i <= h; i++)
{
for (int j = 1; j <= w; j++)
{
cin >> s[i][j];
}
}
for (int i = 1; i <= h; i++)
{
for (int j = 1; j <= w; j++)
{
// a[i][j] = a[i][j - 1] + (s[i][j] == 'J');
b[i][j] = b[i - 1][j] + (s[i][j] == 'I');
c[i][j] = c[i][j - 1] + (s[i][j] == 'O');
}
}
// for (int i = 1; i <= h; i++)
// {
// for (int j = 1; j <= w; j++)
// {
// cout << c[i][j] << ' ';
// }
// cout << '\n';
// }
for (int i = 1; i <= h; i++)
{
for (int j = 1; j <= w; j++)
{
if (s[i][j] == 'J')
{
tong = tong + (b[h][j] - b[i - 1][j]) * (c[i][w] - c[i][j - 1]);
}
}
}
cout << tong;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |