# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1258784 | khanhtt | Foehn Phenomena (JOI17_foehn_phenomena) | C++20 | 34 ms | 47424 KiB |
#include <iostream>
using namespace std;
int h,w,O[3005][3005],I[3005][3005];
long long res=0;
string A[3005];
main(){
ios::sync_with_stdio(0);
cin.tie(nullptr);
cin >> h >> w;
for (int i=1; i<=h; i++){
cin >> A[i];
A[i]="#"+A[i];
}
for (int i=1; i<=h; i++){
for (int j=1; j<=w; j++){
O[i][j]=O[i][j-1]+(A[i][j]=='O');
}
}
for (int i=1; i<=h; i++){
for (int j=1; j<=w; j++){
I[i][j]=I[i-1][j]+(A[i][j]=='I');
}
}
for (int i=1; i<=h; i++){
for (int j=1; j<=w; j++){
if (A[i][j]=='J'){
long long left=O[i][w]-O[i][j],down=I[h][j]-I[i][j];
res+=left*down;
}
}
}
cout << res;
}
컴파일 시 표준 에러 (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... |