Submission #942036

# Submission time Handle Problem Language Result Execution time Memory
942036 2024-03-10T04:13:13 Z carriewang Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
108 ms 160188 KB
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define F first
#define S second
using namespace std;
const int maxn=3005;
ll h,w,a[maxn][maxn],b[maxn][maxn];
string s[maxn];
int main(){
    ios::sync_with_stdio(0),cin.tie(0);
    cin >> h >> w;
    for(int i=0;i<h;i++){
        cin >> s[i];
    }
    ll ans=0;
    for(int i=h-1;i>=0;i--){
        for(int j=w-1;j>=0;j--){
            a[i][j]=a[i+1][j];
            b[i][j]=b[i][j+1];
            if(s[i][j]=='I') a[i][j]++;
            else if(s[i][j]=='O') b[i][j]++;
            else ans+=a[i][j]*b[i][j];
        }
    }
    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 3160 KB Output is correct
6 Correct 1 ms 3160 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3224 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3160 KB Output is correct
13 Correct 2 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 3160 KB Output is correct
6 Correct 1 ms 3160 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3224 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3160 KB Output is correct
13 Correct 2 ms 3164 KB Output is correct
14 Correct 8 ms 18008 KB Output is correct
15 Correct 3 ms 12632 KB Output is correct
16 Correct 3 ms 10332 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 6 ms 18520 KB Output is correct
19 Correct 4 ms 18268 KB Output is correct
20 Correct 4 ms 18268 KB Output is correct
21 Correct 6 ms 18780 KB Output is correct
22 Correct 4 ms 18524 KB Output is correct
23 Correct 5 ms 18560 KB Output is correct
24 Correct 5 ms 18780 KB Output is correct
25 Correct 5 ms 18480 KB Output is correct
26 Correct 4 ms 18524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 3160 KB Output is correct
6 Correct 1 ms 3160 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3224 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3160 KB Output is correct
13 Correct 2 ms 3164 KB Output is correct
14 Correct 8 ms 18008 KB Output is correct
15 Correct 3 ms 12632 KB Output is correct
16 Correct 3 ms 10332 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 6 ms 18520 KB Output is correct
19 Correct 4 ms 18268 KB Output is correct
20 Correct 4 ms 18268 KB Output is correct
21 Correct 6 ms 18780 KB Output is correct
22 Correct 4 ms 18524 KB Output is correct
23 Correct 5 ms 18560 KB Output is correct
24 Correct 5 ms 18780 KB Output is correct
25 Correct 5 ms 18480 KB Output is correct
26 Correct 4 ms 18524 KB Output is correct
27 Correct 108 ms 159088 KB Output is correct
28 Correct 9 ms 44892 KB Output is correct
29 Correct 6 ms 14804 KB Output is correct
30 Correct 1 ms 852 KB Output is correct
31 Correct 89 ms 130696 KB Output is correct
32 Correct 83 ms 159960 KB Output is correct
33 Correct 73 ms 159404 KB Output is correct
34 Correct 104 ms 151632 KB Output is correct
35 Correct 87 ms 159916 KB Output is correct
36 Correct 72 ms 159440 KB Output is correct
37 Correct 105 ms 160188 KB Output is correct
38 Correct 65 ms 130388 KB Output is correct
39 Correct 64 ms 130348 KB Output is correct