# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1261357 | sasde | Bitaro the Brave (JOI19_ho_t1) | C++20 | 1 ms | 324 KiB |
#include<bits/stdc++.h>
using namespace std;
const int N=3e3+5,lg=30,mod=1e9+7;
int hieght,width;
bitset<N>s[N],s1[N];
char a[N][N];
main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> hieght >> width;
for(int i=1;i<=hieght;++i){
for(int j=1;j<=width;++j){
cin >> a[i][j];
}
}
long long ans=0;
for(int k=1;k<=hieght;++k){
long long val=0;
for(int l=1;l<=width;++l){
ans+=val;
if(a[k][l]=='I'){
bitset<N>x=s[l]&s1[l];
val+=x.count();
}
}
for(int l=1;l<=width;++l){
if(a[k][l]=='O')s1[l][k]=1;
if(a[k][l]=='J')s[l][k]=1;
}
}
cout << ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |