Submission #234414

#TimeUsernameProblemLanguageResultExecution timeMemory
234414NONAMETetris (COCI17_tetris)C++17
40 / 80
5 ms384 KiB
#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] && !mk[i][j + 1] && !mk[i + 1][j] && !mk[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] && !mk[i][j + 1] && !mk[i][j + 2] && !mk[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] && !mk[i + 1][j] && !mk[i + 2][j] && !mk[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] && !mk[i][j + 1] && !mk[i + 1][j] && !mk[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] && !mk[i + 1][j] && !mk[i + 1][j + 1] && !mk[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] && !mk[i][j + 1] && !mk[i + 1][j + 1] && !mk[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] && !mk[i + 1][j] && !mk[i + 1][j - 1] && !mk[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] && !mk[i + 1][j - 1] && !mk[i + 1][j] && !mk[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 (stderr)

tetris.cpp: In function 'int main()':
tetris.cpp:32:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (int i = 0; i < n; i++)
     ^~~
tetris.cpp:100:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for (int i = 0; i < 5; i++)
  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...