Submission #646831

# Submission time Handle Problem Language Result Execution time Memory
646831 2022-09-30T20:28:26 Z perchuts Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
137 ms 160304 KB
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define endl '\n'
#define pb push_back
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ii = pair<int,int>;
using iii = tuple<int,int,int>;

const int inf = 2e9+1;
const int mod = 1e9+7;
const int maxn = 3010;

template<typename X, typename Y> bool ckmin(X& x, const Y& y) { return (y < x) ? (x=y,1):0; }
template<typename X, typename Y> bool ckmax(X& x, const Y& y) { return (x < y) ? (x=y,1):0; }

string grid[maxn];
ll suf1[maxn][maxn], suf2[maxn][maxn];
int main(){_
    int h,w;cin>>h>>w;    
    for(int i=0;i<h;++i)cin>>grid[i];
    ll ans = 0;
    for(int i=h-1;~i;--i){
        for(int j=w-1;~j;--j){
            suf1[i][j] = suf1[i][j+1] + (grid[i][j]=='O');
            suf2[i][j] = suf2[i+1][j] + (grid[i][j]=='I');
        }
    }

    for(int i=0;i<h;++i)
        for(int j=0;j<w;++j)
            if(grid[i][j]=='J')ans += suf1[i][j]*suf2[i][j];

    cout<<ans<<endl;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 420 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1364 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 1236 KB Output is correct
11 Correct 1 ms 1364 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 420 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1364 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 1236 KB Output is correct
11 Correct 1 ms 1364 KB Output is correct
12 Correct 1 ms 1364 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
14 Correct 5 ms 7736 KB Output is correct
15 Correct 2 ms 3880 KB Output is correct
16 Correct 3 ms 4692 KB Output is correct
17 Correct 0 ms 556 KB Output is correct
18 Correct 6 ms 8844 KB Output is correct
19 Correct 5 ms 8664 KB Output is correct
20 Correct 5 ms 8612 KB Output is correct
21 Correct 6 ms 8784 KB Output is correct
22 Correct 5 ms 8576 KB Output is correct
23 Correct 6 ms 8660 KB Output is correct
24 Correct 7 ms 8788 KB Output is correct
25 Correct 5 ms 8608 KB Output is correct
26 Correct 5 ms 8660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 420 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1364 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 1236 KB Output is correct
11 Correct 1 ms 1364 KB Output is correct
12 Correct 1 ms 1364 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
14 Correct 5 ms 7736 KB Output is correct
15 Correct 2 ms 3880 KB Output is correct
16 Correct 3 ms 4692 KB Output is correct
17 Correct 0 ms 556 KB Output is correct
18 Correct 6 ms 8844 KB Output is correct
19 Correct 5 ms 8664 KB Output is correct
20 Correct 5 ms 8612 KB Output is correct
21 Correct 6 ms 8784 KB Output is correct
22 Correct 5 ms 8576 KB Output is correct
23 Correct 6 ms 8660 KB Output is correct
24 Correct 7 ms 8788 KB Output is correct
25 Correct 5 ms 8608 KB Output is correct
26 Correct 5 ms 8660 KB Output is correct
27 Correct 122 ms 159112 KB Output is correct
28 Correct 10 ms 19540 KB Output is correct
29 Correct 10 ms 13860 KB Output is correct
30 Correct 1 ms 812 KB Output is correct
31 Correct 99 ms 130988 KB Output is correct
32 Correct 100 ms 160176 KB Output is correct
33 Correct 97 ms 159760 KB Output is correct
34 Correct 112 ms 151932 KB Output is correct
35 Correct 102 ms 160188 KB Output is correct
36 Correct 98 ms 159708 KB Output is correct
37 Correct 137 ms 160304 KB Output is correct
38 Correct 79 ms 130124 KB Output is correct
39 Correct 79 ms 130416 KB Output is correct