# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472741 | Ahmed_Solyman | Tetris (COCI17_tetris) | C++14 | 1 ms | 204 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;
typedef long long ll;
ll n,m;
bool valid(ll i,ll j){
if(i>=0 && j>=0 && i<n && j<m)return 1;
return 0;
}
int main()
{
cin>>n>>m;
vector<string>arr(n);
for(auto &i:arr)cin>>i;
ll a=0,b=0,c=0,d=0,e=0;
map<pair<ll,ll>,bool>vis;
for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){
if(vis[{i,j}])continue;
else if(valid(i,j+1) && valid(i+1,j) && valid(i+1,j+1)){
if(arr[i][j]==arr[i][j+1] && arr[i][j+1]==arr[i+1][j] && arr[i+1][j]==arr[i+1][j+1] && arr[i][j]!='.'){
vis[{i,j}]=1;
vis[{i,j+1}]=1;
vis[{i+1,j}]=1;
vis[{i+1,j+1}]=1;
a++;
}
}
}
}
cout<<a<<endl<<b<<endl<<c<<endl<<d<<endl<<e<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |