# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
234404 | 2020-05-24T07:07:48 Z | NONAME | Tetris (COCI17_tetris) | C++17 | 5 ms | 384 KB |
#include <bits/stdc++.h> #define all(x) x.begin(), x.end() #define sz(x) int(x.size()) #define in(x) freopen(x, "r", stdin) #define out(x) freopen(x, "w", stdout) #define N 100500 #define oo ll(1e16) #define ft first #define sd second #define mp make_pair #define pb push_back #define ppb pop_back #define el '\n' #define elf endl #define base ll(1e9 + 7) using namespace std; typedef long long ll; typedef long double ld; int cnt[5], n, m; string s[100]; bool mk[100][100]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { if (mk[i][j] || s[i][j] == '.') continue; if (i + 1 < n && j + 1 < m && s[i][j] == s[i][j + 1] && s[i][j] == s[i + 1][j] && s[i][j] == s[i + 1][j + 1]) { cnt[0]++; mk[i][j] = mk[i + 1][j] = mk[i][j + 1] = mk[i + 1][j + 1] = 1; continue; } { if (j + 3 < m && s[i][j] == s[i][j + 1] && s[i][j] == s[i][j + 2] && s[i][j] == s[i][j + 3]) { cnt[1]++; mk[i][j] = mk[i][j + 1] = mk[i][j + 2] = mk[i][j + 3] = 1; continue; } if (i + 3 < n && s[i][j] == s[i + 1][j] && s[i][j] == s[i + 2][j] && s[i][j] == s[i + 3][j]) { cnt[1]++; mk[i][j] = mk[i + 1][j] = mk[i + 2][j] = mk[i + 3][j] = 1; continue; } } { if (i + 1 < n && j - 1 >= 0 && j + 1 < m && s[i][j] == s[i][j + 1] && s[i][j] == s[i + 1][j] && s[i][j] == s[i + 1][j - 1]) { cnt[2]++; mk[i][j] = mk[i][j + 1] = mk[i + 1][j] = mk[i + 1][j - 1] = 1; continue; } if (i + 1 < n && j + 2 < m && s[i][j] == s[i + 1][j] && s[i][j] == s[i + 1][j + 1] && s[i][j] == s[i + 2][j + 1]) { cnt[2]++; mk[i][j] = mk[i + 1][j] = mk[i + 1][j + 1] = mk[i + 2][j + 1] = 1; continue; } } { if (i + 1 < n && j + 2 < m && s[i][j] == s[i][j + 1] && s[i][j] == s[i + 1][j + 1] && s[i][j] == s[i + 1][j + 2]) { cnt[3]++; mk[i][j] = mk[i][j + 1] = mk[i + 1][j + 1] = mk[i + 1][j + 2] = 1; continue; } if (i + 2 < n && j - 1 >= 0 && s[i][j] == s[i + 1][j] && s[i][j] == s[i + 1][j - 1] && s[i][j] == s[i + 2][j - 1]) { cnt[3]++; mk[i][j] = mk[i][j + 1] = mk[i + 1][j - 1] = mk[i + 2][j - 1] = 1; continue; } } if (i + 1 < n && j - 1 >= 0 && j + 1 < m && s[i][j] == s[i + 1][j - 1] && s[i][j] == s[i + 1][j] && s[i][j] == s[i + 1][j + 1]) { cnt[4]++; mk[i][j] = mk[i + 1][j - 1] = mk[i + 1][j] = mk[i + 1][j + 1] = 1; continue; } } for (int i = 0; i < 5; i++) cout << cnt[i] << el; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Incorrect | 4 ms | 384 KB | Output isn't correct |
7 | Incorrect | 4 ms | 384 KB | Output isn't correct |
8 | Incorrect | 5 ms | 384 KB | Output isn't correct |
9 | Incorrect | 4 ms | 384 KB | Output isn't correct |
10 | Incorrect | 4 ms | 384 KB | Output isn't correct |