Submission #642896

# Submission time Handle Problem Language Result Execution time Memory
642896 2022-09-20T17:36:55 Z kdn5549 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
325 ms 159068 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

#define eb emplace_back
#define all(v) v.begin(),v.end()
#define ff first
#define ss second

const ll mxn=3005;

char a[mxn][mxn];
ll on[mxn][mxn],in[mxn][mxn];

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    ll h,w; cin>>h>>w;
    for (int i=1;i<=h;i++)
    {
        for (int j=1;j<=w;j++)
        {
            cin>>a[i][j];
            if (a[i][j]=='O') on[i][j]++;
            if (a[i][j]=='I') in[i][j]++;
        }
    }
    for (int i=1;i<=h;i++) for(int j=1;j<=w;j++)
        {
            on[i][j]+=on[i][j-1];
            in[i][j]+=in[i-1][j];
        }
    ll rt=0;
    for (int i=1;i<=h;i++)
        for (int j=1;j<=w;j++)
            if(a[i][j]=='J')
            {
                rt+=(on[i][w]-on[i][j])*(in[h][j]-in[i][j]);
            }
            
    cout<<rt;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 11 ms 8956 KB Output is correct
15 Correct 3 ms 5068 KB Output is correct
16 Correct 5 ms 5332 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 13 ms 10008 KB Output is correct
19 Correct 10 ms 9752 KB Output is correct
20 Correct 9 ms 9684 KB Output is correct
21 Correct 11 ms 9940 KB Output is correct
22 Correct 10 ms 9796 KB Output is correct
23 Correct 9 ms 9684 KB Output is correct
24 Correct 12 ms 9984 KB Output is correct
25 Correct 8 ms 9712 KB Output is correct
26 Correct 9 ms 9684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 11 ms 8956 KB Output is correct
15 Correct 3 ms 5068 KB Output is correct
16 Correct 5 ms 5332 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 13 ms 10008 KB Output is correct
19 Correct 10 ms 9752 KB Output is correct
20 Correct 9 ms 9684 KB Output is correct
21 Correct 11 ms 9940 KB Output is correct
22 Correct 10 ms 9796 KB Output is correct
23 Correct 9 ms 9684 KB Output is correct
24 Correct 12 ms 9984 KB Output is correct
25 Correct 8 ms 9712 KB Output is correct
26 Correct 9 ms 9684 KB Output is correct
27 Correct 325 ms 158512 KB Output is correct
28 Correct 13 ms 26324 KB Output is correct
29 Correct 19 ms 13868 KB Output is correct
30 Correct 1 ms 724 KB Output is correct
31 Correct 239 ms 131392 KB Output is correct
32 Correct 247 ms 159004 KB Output is correct
33 Correct 213 ms 158444 KB Output is correct
34 Correct 267 ms 152284 KB Output is correct
35 Correct 257 ms 158904 KB Output is correct
36 Correct 249 ms 158496 KB Output is correct
37 Correct 317 ms 159068 KB Output is correct
38 Correct 174 ms 130920 KB Output is correct
39 Correct 152 ms 130772 KB Output is correct