# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
884313 |
2023-12-07T06:37:19 Z |
vjudge1 |
Tetris (COCI17_tetris) |
C++17 |
|
1 ms |
348 KB |
#ifndef Local
#pragma GCC optimize("O3,unroll-loops")
const int lim=2e5+100;
#else
const int lim=2e3+100;
#endif
#include "bits/stdc++.h"
using namespace std;
#define int int64_t
#define pb push_back
const int mod=1e9+7;
using pii=pair<int,int>;
inline void solve(){
int n,m;
cin>>n>>m;
string g[n];
for(int i=0;i<n;i++){
cin>>g[i];
}
int ans=0;
for(int i=0;i<n-1;i++){
for(int j=0;j<m-1;j++){
if(g[i][j]=='.')continue;
if(g[i][j]==g[i][j+1]&&
g[i][j]==g[i+1][j]&&
g[i][j]==g[i+1][j+1]){
ans++;
}
}
}
cout<<ans<<"\n";
ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<m-4;j++){
if(g[i][j]=='.')continue;
if(g[i][j]==g[i][j+1]&&
g[i][j]==g[i][j+2]&&
g[i][j]==g[i][j+3]){
ans++;
}
}
}
for(int i=0;i<n-4;i++){
for(int j=0;j<m;j++){
if(g[i][j]=='.')continue;
if(g[i][j]==g[i+1][j]&&
g[i][j]==g[i+2][j]&&
g[i][j]==g[i+3][j]){
ans++;
}
}
}
cout<<ans<<"\n";
int ans1=0,ans2=0;
for(int i=0;i<n-1;i++){
for(int j=1;j<m-1;j++){
if(g[i][j]=='.')continue;
if(g[i][j]==g[i+1][j]){
if(g[i][j]==g[i][j+1]&&
g[i][j]==g[i+1][j-1]){
ans1++;
}
else if(g[i][j]==g[i][j-1]&&
g[i][j]==g[i+1][j+1]){
ans2++;
}
}
}
}
for(int i=1;i<n-1;i++){
for(int j=0;j<m-1;j++){
if(g[i][j]=='.')continue;
if(g[i][j]==g[i][j+1]){
if(g[i][j]==g[i-1][j]&&
g[i][j]==g[i+1][j+1]){
ans1++;
}
else if(g[i][j]==g[i+1][j]&&
g[i][j]==g[i-1][j+1]){
ans2++;
}
}
}
}
cout<<ans1<<"\n"<<ans2<<"\n";
ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(g[i][j]=='.')continue;
int count=
(i+1<n&&g[i][j]==g[i+1][j])+
(j+1<m&&g[i][j]==g[i][j+1])+
(i&&g[i][j]==g[i-1][j])+
(j&&g[i][j]==g[i][j-1]);
if(count==3){
ans++;
}
}
}
cout<<ans<<"\n";
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
#ifdef Local
freopen(".in","r",stdin);
freopen(".out","w",stdout);
#else
//freopen("grass.in","r",stdin);
//freopen("grass.out","w",stdout);
#endif
int t=1;
//cin>>t;
while (t--)
{
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |