Submission #141645

#TimeUsernameProblemLanguageResultExecution timeMemory
141645RadugnnTetris (COCI17_tetris)C++14
80 / 80
3 ms508 KiB
#include <iostream> using namespace std; struct figura { int lin; int col; int a[4][4]; }; struct tip { int rotiri; figura fig[4]; }; tip 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}}}, {3,2, { {1,0,0,0}, {1,1,0,0}, {1,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}}} } } }; int n,m,i,j,t,r,l,c,ic,jc,ok,cnt; char a[11][11],litera; int main () { cin>>n>>m; for (i=0;i<n;i++) for (j=0;j<m;j++) cin>>a[i][j]; for (t=0;t<5;t++) { for (r=0;r<f[t].rotiri;r++) { l=f[t].fig[r].lin; c=f[t].fig[r].col; for (ic=0;ic+l-1<n;ic++) for (jc=0;jc+c-1<m;jc++) { for (litera='a';litera<='z';litera++) { ok=1; for (i=0;i<l;i++) for (j=0;j<c;j++){ if (f[t].fig[r].a[i][j] && a[ic+i][jc+j] != litera) ok=0; if (!f[t].fig[r].a[i][j] && a[ic+i][jc+j] == litera) ok=0; } if(ok) cnt++; } } } cout<<cnt<<"\n"; cnt=0; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...