| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1355121 | nini_gvenetadze | Bitaro the Brave (JOI19_ho_t1) | C++20 | 0 ms | 344 KiB |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int m;
//string s;
cin>>n>>m;
char a[n][m];
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
cin>>a[i][j];
/*if(a[i][j]=='J')
{
}*/
}
}
int b[n][m];
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
b[i][j]=0;
}
}
int c[n][m];
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
c[i][j]=0;
}
}
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
if(a[i][j]=='I')
{
c[i][j]=1;
}
if(i>0)
{
c[i][j]+=c[i-1][j];
}
if(a[i][j]=='O')
{
b[i][j]=1;
}
if(j>0)
{
b[i][j]+=b[i][j-1];
}
}
}
/*
for(int i=1; i<=n; i++)
{
for(int j=1; j<=m; j++)
{
if()
}
}
*/
long long ans=0;
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
if(a[i][j]=='J')
{
int x=b[i][m-1]-b[i][j];
int y=c[n-1][j]-b[i][j];
ans+=x*y;
}
}
}
cout<<ans;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
