# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1258759 | duynam | Bitaro the Brave (JOI19_ho_t1) | C++20 | 111 ms | 150172 KiB |
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn=3000;
const int inf=1e18;
char a[maxn][maxn];
int res=0;
int b[maxn][maxn];
int c[maxn][maxn];
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
cout.tie(nullptr);
if(fopen(".inp","r")){
freopen(".inp","r",stdin);
freopen(".out","w",stdout);
}
int h,w;
cin>>h>>w;
for(int i=1;i<=h;i++){
string s;
cin>>s;
s="*"+s;
for(int j=1;j<=w;j++){
a[i][j]=s[j];
b[i][j]=b[i-1][j]+1*(s[j]=='I');
c[i][j]=c[i][j-1]+1*(s[j]=='O');
}
}
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
if(a[i][j]=='J'){
res+=(b[h][j]-b[i][j])*(c[i][w]-c[i][j]);
}
}
}
cout<<res<<'\n';
}
컴파일 시 표준 에러 (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... |