Submission #1099327

# Submission time Handle Problem Language Result Execution time Memory
1099327 2024-10-11T07:35:06 Z Zflop Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
271 ms 161884 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define sor(x) sort(all(x))
#define pi pair<int,int>
#define vi vector<int>
#define int ll

const int NMAX = 3010;
int N,M;
vector<string>A;
int O[NMAX][NMAX],I[NMAX][NMAX];

void solve() {
    cin >> N >> M;
    A = vector<string>(N);
    for (int i = 0; i < N;++i)
        cin >> A[i];
    for (int i = 0; i < N;++i)
        for (int j = 0; j < M;++j) {
            if (j)
                O[i][j] += O[i][j - 1];
            if(i)
                I[i][j] += I[i - 1][j];
            if(A[i][j] == 'O') O[i][j]++;
            if(A[i][j] == 'I') I[i][j]++;
        }
    int cnt = 0;
    for (int i = 0; i < N;++i)
        for (int j = 0; j < M;++j) {
            if(A[i][j] == 'J')
                cnt += (O[i][M - 1] - O[i][j]) * (I[N - 1][j] - I[i][j]);
        }

    cout << cnt;
}

main(){
    solve();
}

Compilation message

joi2019_ho_t1.cpp:39:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   39 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 2 ms 1116 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1372 KB Output is correct
11 Correct 1 ms 1376 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 2 ms 1116 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1372 KB Output is correct
11 Correct 1 ms 1376 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1120 KB Output is correct
14 Correct 9 ms 7780 KB Output is correct
15 Correct 2 ms 3940 KB Output is correct
16 Correct 4 ms 4724 KB Output is correct
17 Correct 0 ms 356 KB Output is correct
18 Correct 10 ms 9056 KB Output is correct
19 Correct 8 ms 8540 KB Output is correct
20 Correct 8 ms 8884 KB Output is correct
21 Correct 11 ms 9056 KB Output is correct
22 Correct 8 ms 8572 KB Output is correct
23 Correct 13 ms 8800 KB Output is correct
24 Correct 10 ms 9056 KB Output is correct
25 Correct 7 ms 8552 KB Output is correct
26 Correct 7 ms 8804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 2 ms 1116 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1372 KB Output is correct
11 Correct 1 ms 1376 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1120 KB Output is correct
14 Correct 9 ms 7780 KB Output is correct
15 Correct 2 ms 3940 KB Output is correct
16 Correct 4 ms 4724 KB Output is correct
17 Correct 0 ms 356 KB Output is correct
18 Correct 10 ms 9056 KB Output is correct
19 Correct 8 ms 8540 KB Output is correct
20 Correct 8 ms 8884 KB Output is correct
21 Correct 11 ms 9056 KB Output is correct
22 Correct 8 ms 8572 KB Output is correct
23 Correct 13 ms 8800 KB Output is correct
24 Correct 10 ms 9056 KB Output is correct
25 Correct 7 ms 8552 KB Output is correct
26 Correct 7 ms 8804 KB Output is correct
27 Correct 260 ms 159828 KB Output is correct
28 Correct 9 ms 19552 KB Output is correct
29 Correct 17 ms 14088 KB Output is correct
30 Correct 1 ms 856 KB Output is correct
31 Correct 196 ms 133852 KB Output is correct
32 Correct 215 ms 161884 KB Output is correct
33 Correct 225 ms 161372 KB Output is correct
34 Correct 230 ms 155076 KB Output is correct
35 Correct 191 ms 161880 KB Output is correct
36 Correct 237 ms 161360 KB Output is correct
37 Correct 271 ms 161832 KB Output is correct
38 Correct 143 ms 132936 KB Output is correct
39 Correct 166 ms 133120 KB Output is correct