# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1281259 | flo | Bitaro the Brave (JOI19_ho_t1) | C++20 | 286 ms | 150344 KiB |
#include <bits/stdc++.h>
#define task "testing"
#define int long long
#define multitest 0
using namespace std;
const int N = 3e3;
char c[N+5][N+5];
int row[N+5][N+5], col[N+5][N+5];
void flo(int ID) {
int n, m; cin >> n >> m;
for (int x = 1; x <= n; x++) {
for (int y = 1; y <= m; y++) {
cin >> c[x][y];
}
}
for (int x = 1; x <= n; x++) {
for (int y = m; y >= 1; y--) {
row[x][y] = row[x][y+1]+(c[x][y] == 'O');
}
}
for (int y = 1; y <= m; y++) {
for (int x = n; x >= 1; x--) {
col[x][y] = col[x+1][y]+(c[x][y] == 'I');
}
}
int ans = 0;
for (int x = 1; x <= n; x++) {
for (int y = 1; y <= m; y++) {
if (c[x][y] != 'J') continue;
ans += row[x][y]*col[x][y];
}
}
cout << ans << "\n";
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if (fopen(task".inp", "r")) {
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
int TCS = 1, ID = 1;
if (multitest) {
cin >> TCS;
}
while (TCS--) flo(ID++);
return 0;
}
컴파일 시 표준 에러 (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... |