Submission #1074586

# Submission time Handle Problem Language Result Execution time Memory
1074586 2024-08-25T11:19:15 Z NoLove Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
77 ms 88656 KB
/**
 *    author : Lăng Trọng Đạt
 *    created: 2024-08-25
**/
#include <bits/stdc++.h>
using namespace std;
#ifndef LANG_DAT
#define db(...) ;
#endif // LANG_DAT
#define int long long
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define all(v) (v).begin(), (v).end()
using pii = pair<int, int>;
using vi = vector<int>;
#define FOR(i, a, b) for (int i = a; (i) <= (b); i++)
void mx(int& a, int b) { if (b > a) a = b; }
void mi(int& a, int b) { if (b < a) a = b; }
#define si(x) (int)(x.size())
const int INF = 1e18;
const int MOD = 1e9 + 7;

const int N = 3e3 + 5;
int n, m, k, a, b;

string g[N];
int I_in_col[N][N];

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    if (fopen("hi.inp", "r")) {
        freopen("hi.inp", "r", stdin);
//        freopen("hi.out", "w", stdout);
    }

    cin >> n >> m;
    FOR(i, 1, n) {
        cin >> g[i];
        g[i] = '#' + g[i];
        FOR(j, 1, m) {
            I_in_col[i][j] = I_in_col[i - 1][j] + (g[i][j] == 'I');
        }
    }

    int ans = 0;
    FOR(i, 1, n) {
        int cnt = 0;
        FOR(j, 1, m) {
            if (g[i][j] == 'J') cnt += I_in_col[n][j] - I_in_col[i - 1][j];
            if (g[i][j] == 'O') ans += cnt;
            db(i, j, I_in_col[i][j])
        }
    }

    cout << ans;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int32_t main()':
joi2019_ho_t1.cpp:34:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |         freopen("hi.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 552 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 4700 KB Output is correct
6 Correct 1 ms 4696 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 4700 KB Output is correct
9 Correct 1 ms 4700 KB Output is correct
10 Correct 0 ms 2652 KB Output is correct
11 Correct 1 ms 4700 KB Output is correct
12 Correct 1 ms 4700 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 552 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 4700 KB Output is correct
6 Correct 1 ms 4696 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 4700 KB Output is correct
9 Correct 1 ms 4700 KB Output is correct
10 Correct 0 ms 2652 KB Output is correct
11 Correct 1 ms 4700 KB Output is correct
12 Correct 1 ms 4700 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 3 ms 13148 KB Output is correct
15 Correct 1 ms 10844 KB Output is correct
16 Correct 1 ms 7004 KB Output is correct
17 Correct 1 ms 2652 KB Output is correct
18 Correct 4 ms 13276 KB Output is correct
19 Correct 2 ms 13288 KB Output is correct
20 Correct 2 ms 13404 KB Output is correct
21 Correct 4 ms 13280 KB Output is correct
22 Correct 2 ms 13404 KB Output is correct
23 Correct 3 ms 13404 KB Output is correct
24 Correct 4 ms 13280 KB Output is correct
25 Correct 2 ms 13404 KB Output is correct
26 Correct 2 ms 13404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 552 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 4700 KB Output is correct
6 Correct 1 ms 4696 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 4700 KB Output is correct
9 Correct 1 ms 4700 KB Output is correct
10 Correct 0 ms 2652 KB Output is correct
11 Correct 1 ms 4700 KB Output is correct
12 Correct 1 ms 4700 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 3 ms 13148 KB Output is correct
15 Correct 1 ms 10844 KB Output is correct
16 Correct 1 ms 7004 KB Output is correct
17 Correct 1 ms 2652 KB Output is correct
18 Correct 4 ms 13276 KB Output is correct
19 Correct 2 ms 13288 KB Output is correct
20 Correct 2 ms 13404 KB Output is correct
21 Correct 4 ms 13280 KB Output is correct
22 Correct 2 ms 13404 KB Output is correct
23 Correct 3 ms 13404 KB Output is correct
24 Correct 4 ms 13280 KB Output is correct
25 Correct 2 ms 13404 KB Output is correct
26 Correct 2 ms 13404 KB Output is correct
27 Correct 76 ms 87768 KB Output is correct
28 Correct 4 ms 37212 KB Output is correct
29 Correct 4 ms 8028 KB Output is correct
30 Correct 1 ms 2652 KB Output is correct
31 Correct 52 ms 71636 KB Output is correct
32 Correct 50 ms 88404 KB Output is correct
33 Correct 47 ms 88404 KB Output is correct
34 Correct 57 ms 82916 KB Output is correct
35 Correct 49 ms 88584 KB Output is correct
36 Correct 47 ms 88404 KB Output is correct
37 Correct 77 ms 88656 KB Output is correct
38 Correct 37 ms 71252 KB Output is correct
39 Correct 39 ms 71516 KB Output is correct