Submission #200127

# Submission time Handle Problem Language Result Execution time Memory
200127 2020-02-05T13:03:24 Z aloo123 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
589 ms 159096 KB
#include <iostream>
#include <algorithm>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
using namespace std;

const ll N = 5e5+100;
const ll MOD = 1e9+7;
char grid[3005][3005];
ll orb[3005][3005];
ll ing[3005][3005];
int main()
{
    ios_base::sync_with_stdio(0);
    //cin.tie(0);

    ll n,m;
    cin>>n>>m;
    ll ans =0;
    for(int i =1;i<=n;i++)
        for(int j = 1;j<=m;j++)
            cin>>grid[i][j];
    

    for(int i =1;i<=n;i++){
        for(int j =1;j<=m;j++){
            orb[i][j] = orb[i][j-1];
            if(grid[i][j] == 'O') orb[i][j]++;
        }
    }   


    for(int i =1;i<=m;i++){
        for(int j =1;j<=n;j++) {
            ing[j][i] = ing[j-1][i];
            if(grid[j][i] =='I') ing[j][i]++;
        }
    }  

    for(int i =1;i<=n;i++){
        for(int j =1;j<=m;j++){
            if(grid[i][j] == 'J'){
                ll o = orb[i][m]-orb[i][j];
                ll inglets = ing[n][j] - ing[i][j];
                ans += (o*inglets);
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1656 KB Output is correct
6 Correct 6 ms 1528 KB Output is correct
7 Correct 6 ms 1528 KB Output is correct
8 Correct 6 ms 1656 KB Output is correct
9 Correct 6 ms 1528 KB Output is correct
10 Correct 6 ms 1528 KB Output is correct
11 Correct 6 ms 1660 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 6 ms 1528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1656 KB Output is correct
6 Correct 6 ms 1528 KB Output is correct
7 Correct 6 ms 1528 KB Output is correct
8 Correct 6 ms 1656 KB Output is correct
9 Correct 6 ms 1528 KB Output is correct
10 Correct 6 ms 1528 KB Output is correct
11 Correct 6 ms 1660 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 6 ms 1528 KB Output is correct
14 Correct 17 ms 9080 KB Output is correct
15 Correct 8 ms 5116 KB Output is correct
16 Correct 11 ms 5368 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 19 ms 9976 KB Output is correct
19 Correct 17 ms 9848 KB Output is correct
20 Correct 16 ms 9848 KB Output is correct
21 Correct 19 ms 9976 KB Output is correct
22 Correct 16 ms 9848 KB Output is correct
23 Correct 17 ms 9848 KB Output is correct
24 Correct 19 ms 9976 KB Output is correct
25 Correct 16 ms 9848 KB Output is correct
26 Correct 17 ms 9848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1656 KB Output is correct
6 Correct 6 ms 1528 KB Output is correct
7 Correct 6 ms 1528 KB Output is correct
8 Correct 6 ms 1656 KB Output is correct
9 Correct 6 ms 1528 KB Output is correct
10 Correct 6 ms 1528 KB Output is correct
11 Correct 6 ms 1660 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 6 ms 1528 KB Output is correct
14 Correct 17 ms 9080 KB Output is correct
15 Correct 8 ms 5116 KB Output is correct
16 Correct 11 ms 5368 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 19 ms 9976 KB Output is correct
19 Correct 17 ms 9848 KB Output is correct
20 Correct 16 ms 9848 KB Output is correct
21 Correct 19 ms 9976 KB Output is correct
22 Correct 16 ms 9848 KB Output is correct
23 Correct 17 ms 9848 KB Output is correct
24 Correct 19 ms 9976 KB Output is correct
25 Correct 16 ms 9848 KB Output is correct
26 Correct 17 ms 9848 KB Output is correct
27 Correct 556 ms 158712 KB Output is correct
28 Correct 22 ms 26360 KB Output is correct
29 Correct 30 ms 13944 KB Output is correct
30 Correct 6 ms 888 KB Output is correct
31 Correct 411 ms 131580 KB Output is correct
32 Correct 545 ms 159096 KB Output is correct
33 Correct 528 ms 158712 KB Output is correct
34 Correct 465 ms 152440 KB Output is correct
35 Correct 516 ms 159080 KB Output is correct
36 Correct 511 ms 158712 KB Output is correct
37 Correct 589 ms 159096 KB Output is correct
38 Correct 372 ms 130812 KB Output is correct
39 Correct 372 ms 130936 KB Output is correct