Submission #826811

# Submission time Handle Problem Language Result Execution time Memory
826811 2023-08-16T04:46:14 Z LeVanThuc Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
151 ms 159472 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define p(x,y) pair<ll,ll>(x,y)
#define BIT(i,x) ((x>>i)&1)
#define MASK(x) (1<<x)
#define ld long double
#define __builtin_popcount __builtin_popcountll
#define pll pair<ll,ll>
template<class T1,class T2>
bool maximize(T1 &x,const T2 &y)
{
    if(x<y)
    {
        x=y;
        return 1;
    }
    return 0;
}
template<class T1,class T2>
bool minimize(T1 &x,const T2 &y)
{
    if(x>y)
    {
        x=y;
        return 1;
    }
    return 0;
}
void online()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
}
const ll N=3e3+10;
string s[N];
ll Or[N][N],Jr[N][N],n,m,ans;
int main()
{
    online();
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>s[i];
        s[i]=' '+s[i];
        for(int j=m;j>=1;j--)
        {
            if(s[i][j]=='O') Or[i][j]++;
            Or[i][j]+=Or[i][j+1];
            if(s[i][j]=='J')
            {
                Jr[i][j]+=Or[i][j];
            }
            Jr[i][j]+=Jr[i-1][j];
            if(s[i][j]=='I') ans+=Jr[i][j];
        }
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 424 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 424 KB Output is correct
5 Correct 1 ms 1328 KB Output is correct
6 Correct 1 ms 1364 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1364 KB Output is correct
9 Correct 1 ms 1364 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 1 ms 1324 KB Output is correct
12 Correct 1 ms 1364 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 424 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 424 KB Output is correct
5 Correct 1 ms 1328 KB Output is correct
6 Correct 1 ms 1364 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1364 KB Output is correct
9 Correct 1 ms 1364 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 1 ms 1324 KB Output is correct
12 Correct 1 ms 1364 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
14 Correct 6 ms 7764 KB Output is correct
15 Correct 2 ms 3796 KB Output is correct
16 Correct 3 ms 4692 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 7 ms 8796 KB Output is correct
19 Correct 5 ms 8648 KB Output is correct
20 Correct 5 ms 8660 KB Output is correct
21 Correct 7 ms 8788 KB Output is correct
22 Correct 5 ms 8660 KB Output is correct
23 Correct 6 ms 8620 KB Output is correct
24 Correct 7 ms 8884 KB Output is correct
25 Correct 5 ms 8660 KB Output is correct
26 Correct 5 ms 8600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 424 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 424 KB Output is correct
5 Correct 1 ms 1328 KB Output is correct
6 Correct 1 ms 1364 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1364 KB Output is correct
9 Correct 1 ms 1364 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 1 ms 1324 KB Output is correct
12 Correct 1 ms 1364 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
14 Correct 6 ms 7764 KB Output is correct
15 Correct 2 ms 3796 KB Output is correct
16 Correct 3 ms 4692 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 7 ms 8796 KB Output is correct
19 Correct 5 ms 8648 KB Output is correct
20 Correct 5 ms 8660 KB Output is correct
21 Correct 7 ms 8788 KB Output is correct
22 Correct 5 ms 8660 KB Output is correct
23 Correct 6 ms 8620 KB Output is correct
24 Correct 7 ms 8884 KB Output is correct
25 Correct 5 ms 8660 KB Output is correct
26 Correct 5 ms 8600 KB Output is correct
27 Correct 140 ms 158440 KB Output is correct
28 Correct 11 ms 19540 KB Output is correct
29 Correct 10 ms 13852 KB Output is correct
30 Correct 1 ms 844 KB Output is correct
31 Correct 110 ms 130512 KB Output is correct
32 Correct 107 ms 159264 KB Output is correct
33 Correct 108 ms 158872 KB Output is correct
34 Correct 130 ms 151240 KB Output is correct
35 Correct 109 ms 159304 KB Output is correct
36 Correct 116 ms 159004 KB Output is correct
37 Correct 151 ms 159472 KB Output is correct
38 Correct 85 ms 129720 KB Output is correct
39 Correct 85 ms 129996 KB Output is correct