답안 #867176

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
867176 2023-10-27T20:04:14 Z dpsaveslives Bitaro the Brave (JOI19_ho_t1) C++17
20 / 100
6 ms 23388 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3010;
int grid[MAXN][MAXN];
int ing[MAXN][MAXN],orb[MAXN][MAXN];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int H,W; cin >> H >> W; //count for every J how many O's are in the row after it and how many I's are in the column after it
    for(int i = 0;i<H;++i){
        string s; cin >> s;
        for(int j = 0;j<W;++j){
            grid[i][j] = s[j];
        }
    }
    for(int i = 0;i<H;++i){
        int cnt = 0;
        for(int j = W-1;j>=0;--j){
            if(grid[i][j] == 'J'){
                orb[i][j] = cnt;
            }
            else if(grid[i][j] == 'O'){
                cnt++;
            }
        }
    }
    for(int i = 0;i<W;++i){
        int cnt = 0;
        for(int j = H-1;j>=0;--j){
            if(grid[j][i] == 'J'){
                ing[j][i] = cnt;
            }
            else if(grid[j][i] == 'I'){
                cnt++;
            }
        }
    }
    int ans = 0;
    for(int i = 0;i<H;++i){
        for(int j = 0;j<W;++j){
            if(grid[i][j] == 'J'){
                //cout << ing[i][j] << " " << orb[i][j] << "\n";
                ans += ing[i][j]*orb[i][j];
            }
        }
    }
    cout << ans << "\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4560 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8660 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 8540 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4560 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8660 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 8540 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 6 ms 23132 KB Output is correct
15 Correct 2 ms 18780 KB Output is correct
16 Correct 2 ms 12892 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 6 ms 23388 KB Output is correct
19 Correct 4 ms 23132 KB Output is correct
20 Incorrect 4 ms 23132 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4560 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8660 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 8540 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 6 ms 23132 KB Output is correct
15 Correct 2 ms 18780 KB Output is correct
16 Correct 2 ms 12892 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 6 ms 23388 KB Output is correct
19 Correct 4 ms 23132 KB Output is correct
20 Incorrect 4 ms 23132 KB Output isn't correct
21 Halted 0 ms 0 KB -