답안 #939307

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
939307 2024-03-06T08:51:55 Z Pring 길고양이 (JOI20_stray) C++17
15 / 100
45 ms 17228 KB
#include <bits/stdc++.h>
#include "Anthony.h"
using namespace std;

const string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";

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

namespace {
    const int MXN = 20005;
    int n, m, A, B;
    vector<int> eu, ev;
    vector<int> eid[MXN];
    int d[MXN];
    vector<int> tag;

    namespace NSA {
        void BSH(int sr) {
            fill(d, d + n, -1);
            queue<pii> q;
            q.push(mp(0, sr));
            while (q.size()) {
                auto [dep, id] = q.front();
                q.pop();
                if (d[id] != -1) continue;
                d[id] = dep;
                for (auto &e : eid[id]) {
                    int i = eu[e] ^ ev[e] ^ id;
                    if (d[i] != -1) continue;
                    q.push(mp(dep + 1, i));
                }
            }
        }

        vector<int> Mark() {
            BSH(0);
            tag.resize(m);
            FOR(i, 0, m) {
                if (d[eu[i]] == d[ev[i]]) tag[i] = d[eu[i]] % 3;
                else tag[i] = min(d[eu[i]], d[ev[i]]) % 3;
            }
            return tag;
        }
    }

    namespace NSB {
        vector<int> Mark() {
            return vector<int>();
        }
    }
}

vector<int> Mark(int _n, int _m, int _a, int _b, vector<int> _eu, vector<int> _ev) {
    n = _n;
    m = _m;
    A = _a;
    B = _b;
    eu = _eu;
    ev = _ev;
    FOR(i, 0, m) {
        eid[eu[i]].push_back(i);
        eid[ev[i]].push_back(i);
    }
    return (A >= 3 ? NSA::Mark() : NSB::Mark());
}
#include <bits/stdc++.h>
#include "Catherine.h"
using namespace std;

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

namespace {
    int A, B;

    namespace NSA {
        int Move(vector<int> &y) {
            int a = y[0], b = y[1], c = y[2];
            int cnt = (a != 0) + (b != 0) + (c != 0);
            if (cnt == 1) return (a ? 0 : (b ? 1 : 2));
            return (a == 0 ? 1 : (b == 0 ? 2 : 0));
        }
    }

    namespace NSB {
        int Move(vector<int> &y) {
            return -1;
        }
    }
}

void Init(int _a, int _b) {
    A = _a;
    B = _b;
}

int Move(vector<int> y) {
    return (A >= 3 ? NSA::Move(y) : NSB::Move(y));
}
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 16208 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 24 ms 15384 KB Output is correct
4 Correct 34 ms 17192 KB Output is correct
5 Correct 45 ms 17228 KB Output is correct
6 Correct 27 ms 15912 KB Output is correct
7 Correct 28 ms 15948 KB Output is correct
8 Correct 32 ms 16720 KB Output is correct
9 Correct 32 ms 16708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 16208 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 24 ms 15384 KB Output is correct
4 Correct 34 ms 17192 KB Output is correct
5 Correct 45 ms 17228 KB Output is correct
6 Correct 27 ms 15912 KB Output is correct
7 Correct 28 ms 15948 KB Output is correct
8 Correct 32 ms 16720 KB Output is correct
9 Correct 32 ms 16708 KB Output is correct
10 Correct 31 ms 14216 KB Output is correct
11 Correct 30 ms 14140 KB Output is correct
12 Correct 26 ms 14132 KB Output is correct
13 Correct 27 ms 14160 KB Output is correct
14 Correct 27 ms 14412 KB Output is correct
15 Correct 28 ms 14660 KB Output is correct
16 Correct 32 ms 16704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 13648 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 23 ms 13360 KB Output is correct
4 Correct 32 ms 15160 KB Output is correct
5 Correct 34 ms 15160 KB Output is correct
6 Correct 27 ms 13712 KB Output is correct
7 Correct 26 ms 13652 KB Output is correct
8 Correct 30 ms 14416 KB Output is correct
9 Correct 34 ms 14380 KB Output is correct
10 Correct 32 ms 14096 KB Output is correct
11 Correct 28 ms 14236 KB Output is correct
12 Correct 30 ms 14156 KB Output is correct
13 Correct 28 ms 14196 KB Output is correct
14 Correct 32 ms 14328 KB Output is correct
15 Correct 30 ms 14460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 13648 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 23 ms 13360 KB Output is correct
4 Correct 32 ms 15160 KB Output is correct
5 Correct 34 ms 15160 KB Output is correct
6 Correct 27 ms 13712 KB Output is correct
7 Correct 26 ms 13652 KB Output is correct
8 Correct 30 ms 14416 KB Output is correct
9 Correct 34 ms 14380 KB Output is correct
10 Correct 32 ms 14096 KB Output is correct
11 Correct 28 ms 14236 KB Output is correct
12 Correct 30 ms 14156 KB Output is correct
13 Correct 28 ms 14196 KB Output is correct
14 Correct 32 ms 14328 KB Output is correct
15 Correct 30 ms 14460 KB Output is correct
16 Correct 23 ms 12116 KB Output is correct
17 Correct 23 ms 12080 KB Output is correct
18 Correct 26 ms 12100 KB Output is correct
19 Correct 27 ms 12096 KB Output is correct
20 Correct 27 ms 12876 KB Output is correct
21 Correct 26 ms 12616 KB Output is correct
22 Correct 28 ms 14676 KB Output is correct
23 Correct 25 ms 12352 KB Output is correct
24 Correct 24 ms 12356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1296 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 2708 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 2792 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -