답안 #1049966

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1049966 2024-08-09T06:26:14 Z vjudge1 Dango Maker (JOI18_dango_maker) C++17
13 / 100
1 ms 2396 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;

#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define russian setlocale(LC_ALL,"Russian_Russia.20866");
#define file freopen("onlyone.in", "r", stdin), freopen("onlyone.out", "w", stdout);
#define ll long long
#define ull unsigned long long
#define ld long double
#define pll pair<ll, ll>
#define pii pair<int, int>
#define all(s) s.begin(), s.end()
#define pb push_back
#define ins insert
#define mp make_pair
#define sz(x) x.size()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define mem(x) memset(x, 0, sizeof(x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll N = 3010;
const ll M = 600000;
const ll block = 316;
const ll mod = 1e9 + 7;
const ll P = 263;
const ld pi = acos(-1);
const ll inf = 1e9;

ll add(ll a, ll b) {
    if(a + b < 0) return a + b + mod;
    if(a + b >= mod) return a + b - mod;
    return a + b;
}

ll sub(ll a, ll b) {
    return (a - b + mod) % mod;
}

ll mul(ll a, ll b) {
    return a * 1LL * b % mod;
}

ll binpow(ll a, ll n) {
    ll res = 1;
    while(n) {
        if (n & 1) res = mul(res, a);
        a = mul(a, a);
        n >>= 1;
    }
    return res;
}

ll inv(ll x) {
    return binpow(x, mod - 2);
}
int n, m, ans = 0;
char a[N][N];
string order = "RGW";
bool used[N][N];
int horizontal() {
    int cnt = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            bool f = true;
            for(int k = 0; k < 3; k++) {
                if(j + k > m || used[i][j + k] || a[i][j + k] != order[k]) {
                    f = false;
                    break;
                }
            }
            if(f) {
                cnt++;
                for(int k = 0; k < 3; k++) {
                    used[i][j + k] = true;
                }
            }
        }
    }
    return cnt;
}
int vertical() {
    int cnt = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            bool f = true;
            for(int k = 0; k < 3; k++) {
                if(i + k > n || used[i + k][j] || a[i + k][j] != order[k]) {
                    f = false;
                    break;
                }
            }
            if(f) {
                cnt++;
                for(int k = 0; k < 3; k++) {
                    used[i + k][j] = true;
                }
            }
        }
    }
    return cnt;
}
void solve() {
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            cin >> a[i][j];
            used[i][j] = false;
        }
    }
    ans = max(ans, horizontal() + vertical());
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            used[i][j] = false;
        }
    }
    ans = max(ans, vertical() + horizontal());
    cout << ans << '\n';
}
signed main() {
    speed;
    //file
    int test = 1;
    //cin >> test;
    while(test--) {
        solve();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Incorrect 1 ms 2396 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Incorrect 1 ms 2396 KB Output isn't correct
21 Halted 0 ms 0 KB -