Submission #166065

# Submission time Handle Problem Language Result Execution time Memory
166065 2019-11-30T14:45:51 Z davooddkareshki Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
249 ms 83064 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define F first
#define S second

const int maxn = 3e3+10;
const int mod = 1e9+7;

int n, m;
int R[maxn][maxn], D[maxn][maxn];
char a[maxn][maxn];

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    cin>> n >> m;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            cin>> a[i][j];

    ll ans = 0;
    for(int i = n; i >= 1; i--)
        for(int j = m; j >= 1; j--){
            R[i][j] = R[i][j+1] + (a[i][j] == 'O');
            D[i][j] = D[i+1][j] + (a[i][j] == 'I');
            if(a[i][j] == 'J')
                ans += D[i][j] * R[i][j];
        }
    cout<< ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 4 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 4 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 4 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 4 ms 1400 KB Output is correct
14 Correct 13 ms 7544 KB Output is correct
15 Correct 7 ms 5112 KB Output is correct
16 Correct 8 ms 4348 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 14 ms 8056 KB Output is correct
19 Correct 13 ms 7928 KB Output is correct
20 Correct 14 ms 7928 KB Output is correct
21 Correct 15 ms 8056 KB Output is correct
22 Correct 14 ms 7928 KB Output is correct
23 Correct 13 ms 7928 KB Output is correct
24 Correct 15 ms 8056 KB Output is correct
25 Correct 13 ms 7928 KB Output is correct
26 Correct 13 ms 7928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 4 ms 1528 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 4 ms 1400 KB Output is correct
14 Correct 13 ms 7544 KB Output is correct
15 Correct 7 ms 5112 KB Output is correct
16 Correct 8 ms 4348 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 14 ms 8056 KB Output is correct
19 Correct 13 ms 7928 KB Output is correct
20 Correct 14 ms 7928 KB Output is correct
21 Correct 15 ms 8056 KB Output is correct
22 Correct 14 ms 7928 KB Output is correct
23 Correct 13 ms 7928 KB Output is correct
24 Correct 15 ms 8056 KB Output is correct
25 Correct 13 ms 7928 KB Output is correct
26 Correct 13 ms 7928 KB Output is correct
27 Correct 234 ms 82956 KB Output is correct
28 Correct 29 ms 26104 KB Output is correct
29 Correct 19 ms 7928 KB Output is correct
30 Correct 3 ms 632 KB Output is correct
31 Correct 176 ms 69640 KB Output is correct
32 Correct 216 ms 83012 KB Output is correct
33 Correct 216 ms 82592 KB Output is correct
34 Correct 204 ms 80220 KB Output is correct
35 Correct 216 ms 82812 KB Output is correct
36 Correct 216 ms 82680 KB Output is correct
37 Correct 249 ms 83064 KB Output is correct
38 Correct 160 ms 69624 KB Output is correct
39 Correct 160 ms 69420 KB Output is correct