답안 #962976

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
962976 2024-04-14T10:24:40 Z marinaluca Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
256 ms 158928 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC optimize ("O4")
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("unroll-loops")

using namespace std;
#define int long long
#define ll long long
#define XX first
#define YY second
#define pb push_back
#define sz (x) int(x.size())
#define pf pop_front
#define pob pop_back
#define pff push_front

const int NMAX = 3e3;
int n, m;
char v[NMAX + 1][NMAX + 1];
int w[NMAX + 1][NMAX + 1];
int matrix[NMAX + 1][NMAX + 1];
signed main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> m;
    for (int i = 1; i <= n; ++ i){
        for (int j = 1; j <= m; ++ j){
            cin >> v[i][j];
            matrix[i][j] = matrix[i][j - 1];
             w[i][j] = w[i - 1][j];
            if (v[i][j] == 'O')
                matrix[i][j] ++;
            if (v[i][j] == 'I')
                w[i][j] ++;
        }
    }
    int sum = 0;
    for (int i = 1; i <= n; ++ i){
        for (int j = 1; j <= m; ++ j){
            if (v[i][j] == 'J'){
                sum += (w[n][j] - w[i - 1][j]) * (matrix[i][m] - matrix[i][j - 1]);
            }
        }
    }
    cout << sum << "\n";
    return 0 ^ 0;   
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2512 KB Output is correct
5 Correct 2 ms 5212 KB Output is correct
6 Correct 2 ms 5332 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 2 ms 5344 KB Output is correct
9 Correct 1 ms 5212 KB Output is correct
10 Correct 1 ms 5292 KB Output is correct
11 Correct 2 ms 5208 KB Output is correct
12 Correct 2 ms 5212 KB Output is correct
13 Correct 1 ms 5212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2512 KB Output is correct
5 Correct 2 ms 5212 KB Output is correct
6 Correct 2 ms 5332 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 2 ms 5344 KB Output is correct
9 Correct 1 ms 5212 KB Output is correct
10 Correct 1 ms 5292 KB Output is correct
11 Correct 2 ms 5208 KB Output is correct
12 Correct 2 ms 5212 KB Output is correct
13 Correct 1 ms 5212 KB Output is correct
14 Correct 8 ms 18780 KB Output is correct
15 Correct 3 ms 16732 KB Output is correct
16 Correct 4 ms 12636 KB Output is correct
17 Correct 1 ms 2652 KB Output is correct
18 Correct 10 ms 20824 KB Output is correct
19 Correct 7 ms 20828 KB Output is correct
20 Correct 6 ms 20572 KB Output is correct
21 Correct 9 ms 20828 KB Output is correct
22 Correct 7 ms 20824 KB Output is correct
23 Correct 8 ms 20568 KB Output is correct
24 Correct 9 ms 20828 KB Output is correct
25 Correct 8 ms 20572 KB Output is correct
26 Correct 6 ms 20572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2512 KB Output is correct
5 Correct 2 ms 5212 KB Output is correct
6 Correct 2 ms 5332 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 2 ms 5344 KB Output is correct
9 Correct 1 ms 5212 KB Output is correct
10 Correct 1 ms 5292 KB Output is correct
11 Correct 2 ms 5208 KB Output is correct
12 Correct 2 ms 5212 KB Output is correct
13 Correct 1 ms 5212 KB Output is correct
14 Correct 8 ms 18780 KB Output is correct
15 Correct 3 ms 16732 KB Output is correct
16 Correct 4 ms 12636 KB Output is correct
17 Correct 1 ms 2652 KB Output is correct
18 Correct 10 ms 20824 KB Output is correct
19 Correct 7 ms 20828 KB Output is correct
20 Correct 6 ms 20572 KB Output is correct
21 Correct 9 ms 20828 KB Output is correct
22 Correct 7 ms 20824 KB Output is correct
23 Correct 8 ms 20568 KB Output is correct
24 Correct 9 ms 20828 KB Output is correct
25 Correct 8 ms 20572 KB Output is correct
26 Correct 6 ms 20572 KB Output is correct
27 Correct 256 ms 158512 KB Output is correct
28 Correct 12 ms 71772 KB Output is correct
29 Correct 9 ms 16984 KB Output is correct
30 Correct 2 ms 2784 KB Output is correct
31 Correct 159 ms 133596 KB Output is correct
32 Correct 141 ms 158928 KB Output is correct
33 Correct 119 ms 158592 KB Output is correct
34 Correct 187 ms 156252 KB Output is correct
35 Correct 152 ms 158800 KB Output is correct
36 Correct 130 ms 158572 KB Output is correct
37 Correct 249 ms 158776 KB Output is correct
38 Correct 104 ms 133456 KB Output is correct
39 Correct 102 ms 133740 KB Output is correct