# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
341917 | phathnv | Tetris (COCI17_tetris) | C++11 | 1 ms | 380 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>
using namespace std;
typedef long long ll;
const int N = 10;
int m, n, answer[5];
char a[N][N];
void ReadInput(){
cin >> m >> n;
for(int i = 0; i < m; i++)
cin >> a[i];
}
void Count(vector<vector<int>> p, int &cnt){
int r = p.size();
int c = p[0].size();
for(int i = 0; i < m - r + 1; i++)
for(int j = 0; j < n - c + 1; j++){
int mi = 1000, ma = 0;
for(int k = 0; k < r; k++)
for(int l = 0; l < c; l++)
if (p[k][l]){
mi = min(mi, (int) a[i + k][j + l]);
ma = max(ma, (int) a[i + k][j + l]);
}
if (mi == ma && mi != '.')
cnt++;
}
}
void Solve(){
Count({{1, 1}, {1, 1}}, answer[0]);
Count({{1, 1, 1, 1}}, answer[1]);
Count({{1}, {1}, {1}, {1}}, answer[1]);
Count({{0, 1, 1}, {1, 1, 0}}, answer[2]);
Count({{1, 0}, {1, 1}, {0, 1}}, answer[2]);
Count({{1, 1, 0}, {0, 1, 1}}, answer[3]);
Count({{0, 1}, {1, 1}, {1, 0}}, answer[3]);
Count({{0, 1, 0}, {1, 1, 1}}, answer[4]);
Count({{1, 1, 1}, {0, 1, 0}}, answer[4]);
Count({{1, 0}, {1, 1}, {1, 0}}, answer[4]);
Count({{0, 1}, {1, 1}, {0, 1}}, answer[4]);
for(int i = 0; i < 5; i++)
cout << answer[i] << '\n';
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
ReadInput();
Solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |