제출 #644084

#제출 시각아이디문제언어결과실행 시간메모리
644084ghostwriterDango Maker (JOI18_dango_maker)C++14
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include <debug.h> #endif #define ft front #define bk back #define st first #define nd second #define ins insert #define ers erase #define pb push_back #define pf push_front #define _pb pop_back #define _pf pop_front #define lb lower_bound #define ub upper_bound #define mtp make_tuple #define bg begin #define ed end #define all(x) (x).bg(), (x).ed() #define sz(x) (int)(x).size() typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ldb; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pi> vpi; typedef vector<pll> vpll; typedef string str; template<typename T> T gcd(T a, T b) { return (b == 0? a : gcd(b, a % b)); } template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i)) #define FOS(i, r, l) for (int (i) = (r); (i) >= (l); --(i)) #define EACH(i, x) for (auto &(i) : (x)) #define WHILE while #define file "TEST" mt19937 rd(chrono::steady_clock::now().time_since_epoch().count()); ll rand(ll l, ll r) { return uniform_int_distribution<ll>(l, r)(rd); } /* Tran The Bao VOI23 gold medal */ const int N = 3005; int n, m, p1[N][N], p2[N][N], c[N][N], rs = 0; char a[N][N]; signed main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); // freopen(file".inp", "r", stdin); // freopen(file".out", "w", stdout); cin >> n >> m; FOR(i, 1, n) FOR(j, 1, m) cin >> a[i][j]; FOR(i, 1, n) FOR(j, 1, m) { if (a[i][j] != 'R' || a[i][j + 1] != 'G' || a[i][j + 2] != 'W') continue; p1[i][j] = p1[i][j + 1] = p1[i][j + 2] = 1; } FOR(i, 1, n) FOR(j, 1, m) { if (a[i][j] != 'R' || a[i + 1][j] != 'G' || a[i + 2][j] != 'W') continue; p2[i][j] = p2[i + 1][j] = p2[i + 2][j] = 1; } // FOR(i, 1, n) // FOR(j, 1, m) { // debug(i, j, p1[i][j], p2[i][j]); // } FOR(i, 1, n) FOR(j, 1, m) { if (a[i][j] != 'R' || c[i][j]) continue; if (p1[i][j]) { ++rs; c[i][j] = c[i][j + 1] = c[i][j + 2] = 1; continue; } if (p2[i][j]) { if (p1[i + 1][j]) continue; if (!p1[i + 2][j]) { ++rs; c[i][j] = c[i + 1][j] = c[i + 2][j] = 1; continue; } if (a[i + 1][j - 1] == 'R' && p2[i + 1][j - 1]) { ++rs; c[i][j] = c[i + 1][j] = c[i + 2][j] = 1; } } } cout << rs; return 0; } /* 3 4 RGWR GRGG RGWW */ /* From Benq: stuff you should look for * int overflow, array bounds * special cases (n=1?) * do smth instead of nothing and stay organized * WRITE STUFF DOWN * DON'T GET STUCK ON ONE APPROACH */

컴파일 시 표준 에러 (stderr) 메시지

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:30:31: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   30 | #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i))
      |                               ^
dango_maker.cpp:49:5: note: in expansion of macro 'FOR'
   49 |     FOR(i, 1, n)
      |     ^~~
dango_maker.cpp:30:31: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   30 | #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i))
      |                               ^
dango_maker.cpp:50:5: note: in expansion of macro 'FOR'
   50 |     FOR(j, 1, m)
      |     ^~~
dango_maker.cpp:30:31: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   30 | #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i))
      |                               ^
dango_maker.cpp:52:5: note: in expansion of macro 'FOR'
   52 |     FOR(i, 1, n)
      |     ^~~
dango_maker.cpp:30:31: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   30 | #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i))
      |                               ^
dango_maker.cpp:53:5: note: in expansion of macro 'FOR'
   53 |     FOR(j, 1, m) {
      |     ^~~
dango_maker.cpp:30:31: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   30 | #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i))
      |                               ^
dango_maker.cpp:57:5: note: in expansion of macro 'FOR'
   57 |     FOR(i, 1, n)
      |     ^~~
dango_maker.cpp:30:31: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   30 | #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i))
      |                               ^
dango_maker.cpp:58:5: note: in expansion of macro 'FOR'
   58 |     FOR(j, 1, m) {
      |     ^~~
dango_maker.cpp:30:31: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   30 | #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i))
      |                               ^
dango_maker.cpp:66:5: note: in expansion of macro 'FOR'
   66 |     FOR(i, 1, n)
      |     ^~~
dango_maker.cpp:30:31: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   30 | #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i))
      |                               ^
dango_maker.cpp:67:5: note: in expansion of macro 'FOR'
   67 |     FOR(j, 1, m) {
      |     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...