| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1352071 | nguthianmangcay | Bitaro the Brave (JOI19_ho_t1) | C++20 | 0 ms | 344 KiB |
#include<bits/stdc++.h>
using namespace std;
const int N=3e3+3;
const long long inf=1e18+3;
#define ll long long
#define fi first
#define se second
#define VOI void
int a[N][N];
ll cnt[4][N];
VOI jiangly(){
int h,w;
cin>>h>>w;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
char x;
cin>>x;
if(x == 'J'){
a[i][j] = 1;
}
else if(x == 'O'){
a[i][j] = 2;
}
else if(x = 'I'){
a[i][j] = 3;
}
}
}
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
if(a[i][j] == 2)cnt[2][i]++;
if(a[i][j] == 3)cnt[3][j]++;
}
}
ll ans = 0;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
if(a[i][j] == 1){
ans += (cnt[2][j] * cnt[3][i]);
}
}
}
cout<<ans;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
if(fopen("QUANSENSEI.inp","r")){
freopen("O(0).inp","r",stdin);
}
// if(fopen("input.txt","r")){
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// }
jiangly();
// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}
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... | ||||
