Submission #145164

#TimeUsernameProblemLanguageResultExecution timeMemory
145164mihaicanTetris (COCI17_tetris)C++14
80 / 80
2 ms504 KiB
#include <iostream> using namespace std; struct fm { int n; int m; int a[5][5]; }; struct piese { int numar; fm fig[5]; }; piese f[5]={ { 1, { {2,2, { {1,1,0,0},{1,1,0,0},{0,0,0,0},{0,0,0,0}}} } }, { 2, { {1,4, { {1,1,1,1},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {4,1, { {1,0,0,0},{1,0,0,0},{1,0,0,0},{1,0,0,0}}} } }, { 2, { {2,3, { {0,1,1,0},{1,1,0,0},{0,0,0,0},{0,0,0,0}}}, {3,2, { {1,0,0,0},{1,1,0,0},{0,1,0,0},{0,0,0,0}}} } }, { 2, { {2,3, { {1,1,0,0},{0,1,1,0},{0,0,0,0},{0,0,0,0}}}, {3,2, { {0,1,0,0},{1,1,0,0},{1,0,0,0},{0,0,0,0}}} } }, { 4, { {2,3, { {0,1,0,0},{1,1,1,0},{0,0,0,0},{0,0,0,0}}}, {2,3, { {1,1,1,0},{0,1,0,0},{0,0,0,0},{0,0,0,0}}}, {3,2, { {0,1,0,0},{1,1,0,0},{0,1,0,0},{0,0,0,0}}}, {3,2, { {1,0,0,0},{1,1,0,0},{1,0,0,0},{0,0,0,0}}} } } }; int n,m,v[10],y,x; char a[10][10]; int main(){ cin>>n>>m; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin>>a[i][j]; for(int piese=0;piese<5;piese++) for (int f2=0;f2<f[piese].numar;f2++){ x=f[piese].fig[f2].n; y=f[piese].fig[f2].m; for(int i2=0;x+i2<n+1;i2++) for(int j2=0;j2+y<m+1;j2++){ for(int litera='a';litera<='z';litera++){ int ok=1; for(int i=0;i<x;i++) for(int j=0;j<y;j++){ if(f[piese].fig[f2].a[i][j]==1&&a[i2+i][j2+j]!=litera) ok=0; if(f[piese].fig[f2].a[i][j]==0&&a[i2+i][j2+j]==litera) ok=0; } v[piese]+=ok; } } } for(int i=0;i<5;i++) cout<<v[i]<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...