# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
929158 | Zena_Hossam | Tetris (COCI17_tetris) | C++14 | 1 ms | 436 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define ll double
#define ll long long
#define F first
#define S second
#define sz size()
#define all(s) s.begin(),s.end()
#define all1(s) s.rbegin(),s.rend()
int main()
{
// freopen("maxcross.in","r",stdin);freopen("maxcross.out","w",stdout);
ll T=1;
//cin>>T;ll oo=0;
while(T--)
{
ll n,m;
cin>>n>>m;
char a[n][m];
for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){
cin>>a[i][j];
}
}ll arr[5]={};
for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){if(a[i][j]=='.')continue;
if(i+1!=n&&j+1!=m&&(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i][j+1])){
arr[0]++;
}
else if(j+3<m&&((a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i][j+3]))){
arr[1]++;
}
else if(j+1!=m&&j-1>=0&&i+1!=n&&(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1])){
arr[2]++;
}
else if(j+1!=m&&j-1>=0&&i+1!=n&&(a[i][j]==a[i][j-1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1])){
arr[3]++;
}
else if(j+1!=m&&j-1>=0&&i+1!=n&&((a[i][j]==a[i+1][j-1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]))){
arr[4]++;
}
if(i+3<n&&((a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+3][j]))){
arr[1]++;
}
else if(j+1!=m&&i-1>=0&&i+1!=n&&(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j]&&a[i][j]==a[i+1][j+1])){
arr[2]++;
}
else if(j+1!=m&&i-1>=0&&i+1!=n&&(a[i][j]==a[i+1][j]&&a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1])){
arr[3]++;
}
else if(i+1!=n&&i-1>=0&&j+1!=m&&((a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i-1][j]))){
arr[4]++;
}
else if(j+1!=m&&j-1>=0&&i+1!=n&&((a[i][j]==a[i+1][j]&&a[i][j]==a[i][j-1]&&a[i][j]==a[i][j+1]))){
arr[4]++;
}
else if(i-1>=0&&j-1>=0&&i+1!=n&&((a[i][j]==a[i+1][j]&&a[i][j]==a[i-1][j]&&a[i][j]==a[i][j-1]))){
arr[4]++;
}
}
}for(ll i=0;i<5;i++)cout<<arr[i]<<"\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |