답안 #698163

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
698163 2023-02-12T17:56:38 Z Richem Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
604 ms 110020 KB
#include <iostream>
using namespace std;

const int MAX_TAILLE = 4200;

int nbLigne, nbCol;
char grille[MAX_TAILLE][MAX_TAILLE];

int cumulO[MAX_TAILLE][MAX_TAILLE] = {0};
int cumulI[MAX_TAILLE][MAX_TAILLE] = {0};

void input() {
    cin >> nbLigne >> nbCol;

    for(int lig = 0; lig < nbLigne; lig++) {
        for(int col = 0; col < nbCol; col++) {
            cin >> grille[lig][col];
            cumulO[lig][col+1] = cumulO[lig][col];
            cumulI[lig+1][col] = cumulI[lig][col];

            if(grille[lig][col] == 'O') {
                cumulO[lig][col+1]++;
            }
            if(grille[lig][col] == 'I') {
                cumulI[lig+1][col]++;
            }
        }
    }
}

long long total = 0;

int main() {
    input();

    for(int lig = 0; lig < nbLigne; lig++) {
        for(int col = 0; col < nbCol; col++) {
            if(grille[lig][col] != 'J') continue;

            total += ((cumulO[lig][nbCol] - cumulO[lig][col]) * (cumulI[nbLigne][col] - cumulI[lig][col]));
        }
    }

    cout << total << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 2 ms 1492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 2 ms 1492 KB Output is correct
14 Correct 16 ms 7856 KB Output is correct
15 Correct 3 ms 5332 KB Output is correct
16 Correct 9 ms 4376 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 19 ms 8276 KB Output is correct
19 Correct 17 ms 8148 KB Output is correct
20 Correct 17 ms 8168 KB Output is correct
21 Correct 20 ms 8524 KB Output is correct
22 Correct 18 ms 8424 KB Output is correct
23 Correct 17 ms 8324 KB Output is correct
24 Correct 20 ms 8492 KB Output is correct
25 Correct 17 ms 8424 KB Output is correct
26 Correct 17 ms 8316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 2 ms 1492 KB Output is correct
14 Correct 16 ms 7856 KB Output is correct
15 Correct 3 ms 5332 KB Output is correct
16 Correct 9 ms 4376 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 19 ms 8276 KB Output is correct
19 Correct 17 ms 8148 KB Output is correct
20 Correct 17 ms 8168 KB Output is correct
21 Correct 20 ms 8524 KB Output is correct
22 Correct 18 ms 8424 KB Output is correct
23 Correct 17 ms 8324 KB Output is correct
24 Correct 20 ms 8492 KB Output is correct
25 Correct 17 ms 8424 KB Output is correct
26 Correct 17 ms 8316 KB Output is correct
27 Correct 579 ms 105892 KB Output is correct
28 Correct 17 ms 28500 KB Output is correct
29 Correct 38 ms 9020 KB Output is correct
30 Correct 2 ms 596 KB Output is correct
31 Correct 429 ms 81236 KB Output is correct
32 Correct 542 ms 109516 KB Output is correct
33 Correct 516 ms 109712 KB Output is correct
34 Correct 494 ms 94868 KB Output is correct
35 Correct 551 ms 109668 KB Output is correct
36 Correct 516 ms 109720 KB Output is correct
37 Correct 604 ms 110020 KB Output is correct
38 Correct 374 ms 81092 KB Output is correct
39 Correct 360 ms 80960 KB Output is correct