# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
928993 | NourWael | Tetris (COCI17_tetris) | C++17 | 1 ms | 440 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>
#define int long long
using namespace std;
char a[15][15];
int ans[10];
int n,m;
bool check ( int i, int j, int i2, int j2, int i3, int j3, int i4, int j4 ) {
int mini = min ({i,i2,i3,i4,j,j2,j3,j4});
int maxi1 = max ({i,i2,i3,i4}) , maxi2 = max ({j,j2,j3,j4});
if(mini<0 || maxi1>=n || maxi2>=m) return false;
set<int> st;
st.insert(a[i][j]), st.insert(a[i2][j2]), st.insert(a[i3][j3]), st.insert(a[i4][j4]);
if(st.size()>1 || (*st.begin())=='.') return false;
return true;
}
signed main() {
cin>>n>>m;
for(int i=0; i<n; i++)
for(int j=0; j<m; j++)
cin>>a[i][j];
int t=0,t4=0,t2=0,t3=0;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++) {
if(check(i,j, i-1,j, i,j+1, i-1, j+1)) ans[0]++;
if(check(i,j,i,j+1, i,j+2, i,j+3)) ans[1]++;
if(check(i,j,i+1,j, i+2,j, i+3,j)) ans[1]++;
if(check(i,j,i,j+1, i-1,j+1, i-1, j+2)) ans[2]++, t++;
if(check(i,j,i+1,j, i+1,j+1, i+2, j+1)) ans[2]++, t2++;
if(check(i,j, i,j-1, i-1,j-1, i-1, j-2)) ans[3]++;
if(check(i,j, i-1,j, i-1,j+1, i-2, j+1)) ans[3]++;
if(check(i,j,i,j+1, i, j+2, i-1,j+1)) ans[4]++;
if(check(i,j,i+1,j, i+2, j, i+1,j+1)) ans[4]++;
if(check(i,j,i,j-1, i,j-2, i+1,j-1)) ans[4]++;
if(check(i,j,i-1,j, i-2, j, i-1,j-1)) ans[4]++;
}
}
for(int i=0; i<5; i++) cout<<ans[i]<<'\n';
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |