답안 #965311

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
965311 2024-04-18T10:10:24 Z Pring Cell Automaton (JOI23_cell) C++17
16 / 100
208 ms 134212 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3","unroll-loops")
#pragma GCC target("avx2","popcnt","sse4","abm")
using namespace std;

#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif

#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MXN = 500005, MXC = 4105;
int n, Q;
int a[MXC][MXC];
queue<pii> q;
int ans[MXC];

void miku() {
    int x, y;
    cin >> n >> Q;
    FOR(i, 0, MXC) FOR(j, 0, MXC) a[i][j] = MXC - 1;
    FOR(i, 0, n) {
        cin >> x >> y;
        x += 2005;
        y += 2005;
        a[x][y] = 0;
        q.push(mp(x, y));
    }
    auto PUSH = [&](int x, int y, int k) -> void {
        if (a[x][y] < MXC - 1) return;
        a[x][y] = k + 1;
        q.push(mp(x, y));
    };
    while (q.size()) {
        auto [x, y] = q.front();
        q.pop();
        if (a[x][y] == 1005) break;
        PUSH(x + 1, y, a[x][y]);
        PUSH(x, y + 1, a[x][y]);
        PUSH(x - 1, y, a[x][y]);
        PUSH(x, y - 1, a[x][y]);
    }
    FOR(i, 0, MXC) FOR(j, 0, MXC) ans[a[i][j]]++;
    while (Q--) {
        cin >> n;
        cout << ans[n] << '\n';
    }
}

int32_t main() {
    cin.tie(0) -> sync_with_stdio(false);
    cin.exceptions(cin.failbit);
    miku();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 86 ms 66384 KB Output is correct
2 Correct 76 ms 66396 KB Output is correct
3 Correct 78 ms 66440 KB Output is correct
4 Correct 79 ms 66392 KB Output is correct
5 Correct 71 ms 66432 KB Output is correct
6 Correct 74 ms 66392 KB Output is correct
7 Correct 71 ms 66396 KB Output is correct
8 Correct 83 ms 66644 KB Output is correct
9 Correct 73 ms 66392 KB Output is correct
10 Correct 81 ms 66656 KB Output is correct
11 Correct 72 ms 66440 KB Output is correct
12 Correct 77 ms 66440 KB Output is correct
13 Correct 73 ms 66396 KB Output is correct
14 Correct 78 ms 66396 KB Output is correct
15 Correct 74 ms 66392 KB Output is correct
16 Correct 71 ms 66428 KB Output is correct
17 Correct 69 ms 66432 KB Output is correct
18 Correct 85 ms 66652 KB Output is correct
19 Correct 71 ms 66392 KB Output is correct
20 Correct 75 ms 66680 KB Output is correct
21 Correct 70 ms 66648 KB Output is correct
22 Correct 74 ms 66444 KB Output is correct
23 Correct 81 ms 66392 KB Output is correct
24 Correct 73 ms 66396 KB Output is correct
25 Correct 69 ms 66396 KB Output is correct
26 Correct 71 ms 66396 KB Output is correct
27 Correct 69 ms 66392 KB Output is correct
28 Correct 76 ms 66392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 86 ms 66384 KB Output is correct
2 Correct 76 ms 66396 KB Output is correct
3 Correct 78 ms 66440 KB Output is correct
4 Correct 79 ms 66392 KB Output is correct
5 Correct 71 ms 66432 KB Output is correct
6 Correct 74 ms 66392 KB Output is correct
7 Correct 71 ms 66396 KB Output is correct
8 Correct 83 ms 66644 KB Output is correct
9 Correct 73 ms 66392 KB Output is correct
10 Correct 81 ms 66656 KB Output is correct
11 Correct 72 ms 66440 KB Output is correct
12 Correct 77 ms 66440 KB Output is correct
13 Correct 73 ms 66396 KB Output is correct
14 Correct 78 ms 66396 KB Output is correct
15 Correct 74 ms 66392 KB Output is correct
16 Correct 71 ms 66428 KB Output is correct
17 Correct 69 ms 66432 KB Output is correct
18 Correct 85 ms 66652 KB Output is correct
19 Correct 71 ms 66392 KB Output is correct
20 Correct 75 ms 66680 KB Output is correct
21 Correct 70 ms 66648 KB Output is correct
22 Correct 74 ms 66444 KB Output is correct
23 Correct 81 ms 66392 KB Output is correct
24 Correct 73 ms 66396 KB Output is correct
25 Correct 69 ms 66396 KB Output is correct
26 Correct 71 ms 66396 KB Output is correct
27 Correct 69 ms 66392 KB Output is correct
28 Correct 76 ms 66392 KB Output is correct
29 Correct 69 ms 66436 KB Output is correct
30 Correct 98 ms 66392 KB Output is correct
31 Correct 137 ms 66392 KB Output is correct
32 Correct 196 ms 69672 KB Output is correct
33 Correct 91 ms 66452 KB Output is correct
34 Correct 104 ms 66460 KB Output is correct
35 Correct 122 ms 66396 KB Output is correct
36 Correct 72 ms 66424 KB Output is correct
37 Correct 76 ms 66428 KB Output is correct
38 Correct 153 ms 66728 KB Output is correct
39 Correct 208 ms 67344 KB Output is correct
40 Correct 197 ms 69972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 78 ms 134192 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 78 ms 134192 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 73 ms 134212 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 73 ms 134212 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 86 ms 66384 KB Output is correct
2 Correct 76 ms 66396 KB Output is correct
3 Correct 78 ms 66440 KB Output is correct
4 Correct 79 ms 66392 KB Output is correct
5 Correct 71 ms 66432 KB Output is correct
6 Correct 74 ms 66392 KB Output is correct
7 Correct 71 ms 66396 KB Output is correct
8 Correct 83 ms 66644 KB Output is correct
9 Correct 73 ms 66392 KB Output is correct
10 Correct 81 ms 66656 KB Output is correct
11 Correct 72 ms 66440 KB Output is correct
12 Correct 77 ms 66440 KB Output is correct
13 Correct 73 ms 66396 KB Output is correct
14 Correct 78 ms 66396 KB Output is correct
15 Correct 74 ms 66392 KB Output is correct
16 Correct 71 ms 66428 KB Output is correct
17 Correct 69 ms 66432 KB Output is correct
18 Correct 85 ms 66652 KB Output is correct
19 Correct 71 ms 66392 KB Output is correct
20 Correct 75 ms 66680 KB Output is correct
21 Correct 70 ms 66648 KB Output is correct
22 Correct 74 ms 66444 KB Output is correct
23 Correct 81 ms 66392 KB Output is correct
24 Correct 73 ms 66396 KB Output is correct
25 Correct 69 ms 66396 KB Output is correct
26 Correct 71 ms 66396 KB Output is correct
27 Correct 69 ms 66392 KB Output is correct
28 Correct 76 ms 66392 KB Output is correct
29 Correct 69 ms 66436 KB Output is correct
30 Correct 98 ms 66392 KB Output is correct
31 Correct 137 ms 66392 KB Output is correct
32 Correct 196 ms 69672 KB Output is correct
33 Correct 91 ms 66452 KB Output is correct
34 Correct 104 ms 66460 KB Output is correct
35 Correct 122 ms 66396 KB Output is correct
36 Correct 72 ms 66424 KB Output is correct
37 Correct 76 ms 66428 KB Output is correct
38 Correct 153 ms 66728 KB Output is correct
39 Correct 208 ms 67344 KB Output is correct
40 Correct 197 ms 69972 KB Output is correct
41 Runtime error 78 ms 134192 KB Execution killed with signal 11
42 Halted 0 ms 0 KB -