| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 105495 | leonarda | Tetris (COCI17_tetris) | C++14 | 3 ms | 512 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;
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pi;
typedef long long int lint;
const int inf = 0x3f3f3f3f;
const int maxn = 15;
int n, m;
char a[maxn][maxn];
bool memo[maxn][maxn];
int cnt[5];
bool fuki1(int x, int y, char c) {
	if(c == a[x + 1][y] and c == a[x][y + 1] and c == a[x + 1][y + 1]) {
		memo[x][y] = memo[x + 1][y] = memo[x][y + 1] = memo[x + 1][y + 1] = 1;
		return 1;
	}
	return 0;
}
bool fuki2(int x, int y, char c) {
	if(a[x + 1][y] == c and a[x + 2][y] == c and  a[x + 3][y] == c) {
		memo[x][y] = memo[x + 1][y] = memo[x + 2][y] = memo[x + 3][y] = 1;
		return 1;
	}
	if(c == a[x][y + 1] and c == a[x][y + 2] and c == a[x][y + 3]) {
		memo[x][y] = memo[x][y + 1] = memo[x][y + 2] = memo[x][y + 3] = 1;
		return 1;
	}
	return 0;
}
bool fuki3(int x, int y, char c) {
	if(c == a[x + 1][y] and c == a[x][y + 1] and c == a[x + 1][y - 1]) {
		memo[x][y] = memo[x][y + 1] = memo[x + 1][y] = memo[x + 1][y - 1] = 1;
		return 1;
	}
	if(c == a[x + 1][y] and c == a[x + 1][y + 1] and c == a[x + 2][y + 1]) {
		memo[x][y] = memo[x + 1][y] = memo[x + 1][y + 1] = memo[x + 2][y + 1] = 1;
		return 1;
	}
	return 0;
}
bool fuki4(int x, int y, char c) {
	if(c == a[x][y + 1] and c == a[x + 1][y + 1] and c == a[x + 1][y + 2]) {
		memo[x][y] = memo[x][y + 1] = memo[x + 1][y + 1] = memo[x + 1][y + 2] = 1;
		return 1;
	}
	if(c == a[x + 1][y] and c == a[x + 1][y - 1] and c == a[x + 2][y - 1]) {
		memo[x][y] = memo[x + 1][y] = memo[x + 1][y - 1] = memo[x + 2][y - 1] = 1;
		return 1;
	}
	return 0;
}
bool fuki5(int x, int y, char c) {
	if(c == a[x + 1][y] and c == a[x + 1][y - 1] and c == a[x + 1][y + 1]) {
		memo[x][y] = memo[x + 1][y + 1] = memo[x + 1][y - 2] = memo[x + 1][y] = 1;
		return 1;
	}
	if(c == a[x + 1][y] and c == a[x + 1][y - 1] and c == a[x + 2][y]) {
		memo[x][y] = memo[x + 1][y] = memo[x + 1][y - 1] = memo[x + 2][y] = 1;
		return 1;
	}
	if(c == a[x + 1][y] and c == a[x + 2][y] and c == a[x + 1][y + 1]) {
		memo[x][y] = memo[x + 1][y] = memo[x + 2][y] = memo[x + 1][y + 1] = 1;
		return 1;
	}
	if(c == a[x][y + 1] and c == a[x][y + 2] and c == a[x + 1][y + 1]) {
		memo[x][y] = memo[x][y + 1] = memo[x][y + 2] = memo[x + 1][y + 1] = 1;
		return 1;
	}
	return 0;
}
int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	cin >> n >> m;
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= m; ++j)
			cin >> a[i][j];
	
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= m; ++j) {
			if(a[i][j] != '.' and not memo[i][j]) {
//				cout << i << " " << j << endl;
				if(fuki1(i, j, a[i][j])) {
//					cout << 1 << endl;
					cnt[0]++;
				} else if(fuki2(i, j, a[i][j])) {
//					cout << 2 << endl;
					cnt[1]++;
				} else if(fuki3(i, j, a[i][j])) {
//					cout << 3 << endl;
					cnt[2]++;
				} else if(fuki4(i, j, a[i][j])) {
//					cout << 4 << endl;
					cnt[3]++;
				} else if(fuki5(i, j, a[i][j])) {
//					cout << 5 << endl;
					cnt[4]++;
				}
			}
		}
	}
	
	for(int i = 0; i < 5; ++i) {
		if(i) cout << endl;
		cout << cnt[i];
    }
  
return 0;
}
//pcelica maja
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
