Submission #995270

#TimeUsernameProblemLanguageResultExecution timeMemory
995270gmroh06Dango Maker (JOI18_dango_maker)C++14
100 / 100
105 ms19056 KiB
#include <bits/stdc++.h> using ll = long long; inline void fastio() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); } ll n, m, ans; std::string s[3030]; std::vector<ll> ver, hor; int main() { fastio(); std::cin >> n >> m; for (ll i = 0; i < n; i++) { std::cin >> s[i]; } for (ll i = 0; i < n + m; i++) { ver = std::vector<ll>(); hor = std::vector<ll>(); for (ll j = 0; j < n; j++) { ll k = i - j; if (k < 0 or k >= m) continue; if (s[j][k] == 'R') { if (j < n - 2 and s[j + 1][k] == 'G' and s[j + 2][k] == 'W') { ver.emplace_back(j); ans++; } if (k < m - 2 and s[j][k + 1] == 'G' and s[j][k + 2] == 'W') { hor.emplace_back(j); ans++; } } } for (auto x = ver.begin(), y = hor.begin(); x < ver.end() and y < hor.end();) { if (*y - *x < 0) { y++; } else if (*y - *x > 2) { x++; } else { ans--; x++, y++; } } } std::cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...