Submission #160390

#TimeUsernameProblemLanguageResultExecution timeMemory
160390godwindDango Maker (JOI18_dango_maker)C++14
13 / 100
3 ms636 KiB
#pragma GCC optimize("Ofast") #pragma GCC optimize("no-stack-protector") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("fast-math") #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") #include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <stdio.h> #include <cstdio> #include <math.h> #include <cmath> #include <string> #include <cstring> #include <queue> #include <deque> #include <random> #include <iomanip> #include <bitset> using namespace std; template<typename T> void uin(T &a, T b) { if (b < a) { a = b; } } template<typename T> void uax(T &a, T b) { if (b > a) { a = b; } } #define int long long #define left left228 #define right right228 #define prev prev228 #define list list228 #define mp make_pair #define all(v) v.begin(), v.end() #define forn(i, n) for (int i = 0; i < (int)n; ++i) #define firn(i, n) for (int i = 1; i < (int)n; ++i) #define x first #define y second const int N = 3007; char a[N][N]; bool used[N][N]; vector< pair<int, int> > cells[2 * N]; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { cin >> a[i][j]; cells[i + (m - j + 1)].push_back({i, j}); } } int res = 0; for (int s = 2; s <= n + m; ++s) { for (pair<int, int> p : cells[s]) { int i = p.first, j = p.second; if (j + 2 <= m && !used[i][j] && !used[i][j + 1] && !used[i][j + 2] && a[i][j] == 'R' && a[i][j + 1] == 'G' && a[i][j + 2] == 'W') { used[i][j] = used[i][j + 1] = used[i][j + 2] = 1; ++res; } if (i + 2 <= n && !used[i][j] && !used[i + 1][j] && !used[i + 2][j] && a[i][j] == 'R' && a[i + 1][j] == 'G' && a[i + 2][j] == 'W') { used[i][j] = used[i + 1][j] = used[i + 2][j] = 1; ++res; } } } cout << res << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...