# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
308245 | Bill_00 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 1085 ms | 179908 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pp push
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
using namespace std;
char a[3005][3005];
ll dpi[3005][3005];
ll dpo[3005][3005];
vector<pair<int,int> >J;
int main(){
int h,w;
cin >> h >> w;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
cin >> a[i][j];
if(a[i][j]=='J'){
J.pb(mp(i,j));
}
}
}
for(int i=1;i<=w;i++){
for(int j=h;j>=1;j--){
if(a[j][i]=='I'){
dpi[j][i]=dpi[j+1][i]+1;
}
else dpi[j][i]=dpi[j+1][i];
}
}
for(int i=1;i<=h;i++){
for(int j=w;j>=1;j--){
if(a[i][j]=='O'){
dpo[i][j]=dpo[i][j+1]+1;
}
else dpo[i][j]=dpo[i][j+1];
}
}
ll ans=0;
for(int i=0;i<J.size();i++){
int x=J[i].ff;
int y=J[i].ss;
ans+=(dpo[x][y]*dpi[x][y]);
}
cout << ans;
}
컴파일 시 표준 에러 (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... |