이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
using namespace std;
char t[4000][4000];
bool czy_pion(int x,int y)
{
return (t[x][y]=='G' && t[x-1][y]=='R' && t[x+1][y]=='W');
}
bool czy_poz(int x,int y)
{
return (t[x][y]=='G' && t[x][y-1]=='R' && t[x][y+1]=='W');
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cin>>t[i][j];
int wynik=0;
for(int i=1;i<=n+m-1;i++)
{
int x=min(n,i);
int y=max(1,i-n+1);
int teraz=0,wys_pion=0,wys_poz=0,ost=0;
while(x>=1 && y<=m)
{
bool pion=0,poz=0;
pion=czy_pion(x,y);
poz=czy_poz(x,y);
if(pion)
wys_pion=max(ost,wys_pion)+1;
if(poz)
wys_poz=max(ost,wys_poz)+1;
ost=teraz;
teraz=max(wys_pion,wys_poz);
x--;
y++;
}
wynik+=teraz;
}
cout<<wynik;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |