Submission #472741

#TimeUsernameProblemLanguageResultExecution timeMemory
472741Ahmed_SolymanTetris (COCI17_tetris)C++14
16 / 80
1 ms204 KiB
#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 timeMemoryGrader output
Fetching results...