Submission #118700

# Submission time Handle Problem Language Result Execution time Memory
118700 2019-06-19T12:24:09 Z M_H_H_7 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
491 ms 188664 KB
//In The Name of Beauty
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 5e3 + 8;
ll const INF  = 1e12 + 8;
ll const delta = 1000000007;
char table[MAXN][MAXN];
ll I[MAXN][MAXN], O[MAXN][MAXN];
int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n , m;
    cin >> n >> m;
    for(ll i = 1;i <= n;i++){
        for(ll j = 1;j <= m;j++)cin >> table[i][j];
    }
    for(ll i = 1;i <= n;i++){
        ll temp = 0;
        for(ll j = m;j >= 1;j--){
            temp += (table[i][j] == 'O');
            O[i][j] = temp;
        }
    }
    for(ll i = 1;i <= m;i++){
        ll temp = 0;
        for(ll j = n;j >= 1;j--){
            temp += (table[j][i] == 'I');
            I[j][i] = temp;
        }
    }
    ll ans = 0;
    for(ll i = 1;i <= n;i++){
        for(ll j = 1;j <= m;j++){
            if(table[i][j] != 'J')continue;
            ans += (I[i][j] * O[i][j]);
        }
    }
    cout << ans;
    return 0;
}
//Written by M_H_H_7
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 1664 KB Output is correct
6 Correct 3 ms 1664 KB Output is correct
7 Correct 3 ms 1664 KB Output is correct
8 Correct 3 ms 1664 KB Output is correct
9 Correct 3 ms 1664 KB Output is correct
10 Correct 3 ms 1536 KB Output is correct
11 Correct 3 ms 1792 KB Output is correct
12 Correct 3 ms 1664 KB Output is correct
13 Correct 3 ms 1664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 1664 KB Output is correct
6 Correct 3 ms 1664 KB Output is correct
7 Correct 3 ms 1664 KB Output is correct
8 Correct 3 ms 1664 KB Output is correct
9 Correct 3 ms 1664 KB Output is correct
10 Correct 3 ms 1536 KB Output is correct
11 Correct 3 ms 1792 KB Output is correct
12 Correct 3 ms 1664 KB Output is correct
13 Correct 3 ms 1664 KB Output is correct
14 Correct 11 ms 9600 KB Output is correct
15 Correct 5 ms 5504 KB Output is correct
16 Correct 8 ms 5632 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 15 ms 10624 KB Output is correct
19 Correct 9 ms 10496 KB Output is correct
20 Correct 13 ms 10368 KB Output is correct
21 Correct 15 ms 10596 KB Output is correct
22 Correct 14 ms 10496 KB Output is correct
23 Correct 13 ms 10368 KB Output is correct
24 Correct 14 ms 10624 KB Output is correct
25 Correct 14 ms 10496 KB Output is correct
26 Correct 14 ms 10340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 1664 KB Output is correct
6 Correct 3 ms 1664 KB Output is correct
7 Correct 3 ms 1664 KB Output is correct
8 Correct 3 ms 1664 KB Output is correct
9 Correct 3 ms 1664 KB Output is correct
10 Correct 3 ms 1536 KB Output is correct
11 Correct 3 ms 1792 KB Output is correct
12 Correct 3 ms 1664 KB Output is correct
13 Correct 3 ms 1664 KB Output is correct
14 Correct 11 ms 9600 KB Output is correct
15 Correct 5 ms 5504 KB Output is correct
16 Correct 8 ms 5632 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 15 ms 10624 KB Output is correct
19 Correct 9 ms 10496 KB Output is correct
20 Correct 13 ms 10368 KB Output is correct
21 Correct 15 ms 10596 KB Output is correct
22 Correct 14 ms 10496 KB Output is correct
23 Correct 13 ms 10368 KB Output is correct
24 Correct 14 ms 10624 KB Output is correct
25 Correct 14 ms 10496 KB Output is correct
26 Correct 14 ms 10340 KB Output is correct
27 Correct 475 ms 174792 KB Output is correct
28 Correct 23 ms 28664 KB Output is correct
29 Correct 21 ms 14428 KB Output is correct
30 Correct 3 ms 896 KB Output is correct
31 Correct 343 ms 136760 KB Output is correct
32 Correct 456 ms 187852 KB Output is correct
33 Correct 450 ms 188160 KB Output is correct
34 Correct 394 ms 158456 KB Output is correct
35 Correct 455 ms 187836 KB Output is correct
36 Correct 460 ms 188024 KB Output is correct
37 Correct 491 ms 188664 KB Output is correct
38 Correct 318 ms 135980 KB Output is correct
39 Correct 323 ms 136056 KB Output is correct