이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#define int long long
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int h,w;
cin>>h>>w;
char g[h+5][w+5];
for(int i=1; i<=h; i++){
for(int j=1; j<=w; j++){
cin>>g[i][j];
}
}
int so[h+5][w+5], si[h+5][w+5];
memset(so,0,sizeof(so)); memset(si,0,sizeof(si));
//Orb: sec is higher; Ingot: fst is higher
for(int i=1; i<=h; i++){
for(int j=w; j>=1; j--){
so[i][j] = so[i][j+1];
if(g[i][j]=='O') so[i][j]++;
}
}
for(int i=h; i>=1; i--){
for(int j=1; j<=w; j++){
si[i][j]=si[i+1][j];
if(g[i][j]=='I') si[i][j]++;
}
}
int an=0;
for(int i=1; i<=h; i++){
for(int j=1; j<=w; j++){
if(g[i][j]=='J') an += (so[i][j]*si[i][j]);
}
}
cout<<an;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |