답안 #591147

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
591147 2022-07-06T23:04:46 Z dryeab Bitaro the Brave (JOI19_ho_t1) C++17
20 / 100
5 ms 848 KB
#include <bits/stdc++.h>

using ll = long long;

using namespace std;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int h, w;
    cin >> h >> w;

    vector<vector<char>> grid(h, vector<char>(w)), mark(h, vector<char>(w));
    char c;

    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j)
            cin >> grid[i][j];
    }

    int ok;
    for (int i = 0; i < w; ++i) {
        ok = 0;
        for (int j = h - 1; j >= 0; --j) {
            if (grid[j][i] == 'I')
                ok++;
            else if (grid[j][i] == 'J' && ok)
                mark[j][i] = ok;
        }
    }

    int res = 0, cnt;
    for (int i = 0; i < h; ++i) {
        cnt = 0;
        for (int j = 0; j < w; ++j) {
            cnt += mark[i][j];
            if (grid[i][j] == 'O')
                res += cnt;
        }
    }

    cout << res;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:16:10: warning: unused variable 'c' [-Wunused-variable]
   16 |     char c;
      |          ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 244 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 244 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Incorrect 5 ms 848 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 244 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Incorrect 5 ms 848 KB Output isn't correct
15 Halted 0 ms 0 KB -