#include <iostream>
using namespace std;
struct figura {
int n;
int m;
int a[4][4];
};
struct tip {
int nr;
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} }
},
{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, i, j, i2, j2, k, p, ok, lin, col;
int sol[5];
char a[12][12];
int main()
{
cin >> n >> m;
for (i=0; i<n; i++){
for (j=0; j<m; j++){
cin >> a[i][j];
}
}
for (k=0; k<5; k++){
for (p=0; p<f[k].nr; p++){
lin = f[k].fig[p].n;
col = f[k].fig[p].m;
for (i=0; i+lin-1<n; i++){
for (j=0; j+col-1<m; j++){
for (int lit='a'; lit<='z'; lit++){
ok = 1;
for (i2=0; i2<lin; i2++){
for (j2=0; j2<col; j2++){
if (f[k].fig[p].a[i2][j2] == 1 && a[i+i2][j+j2] != lit){
ok = 0;
}
if (f[k].fig[p].a[i2][j2] == 0 && a[i+i2][j+j2] == lit){
ok = 0;
}
}
}
sol[k] += ok;
}
}
}
}
}
for (i=0; i<5; i++){
cout << sol[i] << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
504 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |