답안 #590871

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590871 2022-07-06T12:32:22 Z Namnamseo 길고양이 (JOI20_stray) C++17
15 / 100
55 ms 16920 KB
#include "Anthony.h"
#include <bitset>
#include <vector>
using namespace std;
using vi=vector<int>;

namespace {
const int maxn = int(2e4) + 10;

int n;

struct Edge { int l, r; } ev[maxn];
vector<int> es[maxn];
int par[maxn], pei[maxn];
int lev[maxn];
int col[maxn];

void bfs() {
    static int q[maxn];
    static bitset<maxn> vis;
    int f = 0, t = 1; vis.set(0);
    while (f < t) {
        int x = q[f++];
        for (int ei : es[x]) {
            int y = ev[ei].l + ev[ei].r - x;
            if (vis[y]) continue;
            vis.set(y);
            par[y] = x; pei[y] = ei; lev[y] = lev[x]+1;
            q[t++] = y;
        }
    }
}

vi Case1(int N, int M, vi U, vi V) {
    n = N;
    for (int i=0; i<M; ++i) {
        ev[i] = {U[i], V[i]};
        es[U[i]].push_back(i);
        es[V[i]].push_back(i);
    }
    bfs();

    for (int i=0; i<M; ++i) {
        int a = ev[i].l, b = ev[i].r;
        col[i] = min(lev[a], lev[b])%3;
    }
    return vi(col, col+M);
}

}  // namespace

vi Mark(int N, int M, int A, int B, vi U, vi V) {
    if (B == 0) return Case1(N, M, U, V);
    return {};
}
#include "Catherine.h"
#include <vector>
using namespace std;
using vi=vector<int>;

namespace {
int A, B;

int Move1(vi &y) {
    int oc = 0;
    for (int i=0; i<3; ++i) if (y[i]) ++oc;
    if (oc == 1) for (int i=0; i<3; ++i) if (y[i]) return i;

    int tmp = 0;
    for (int i=0; i<3; ++i) if (y[i]) tmp += i;
    tmp += 2;
    tmp *= 2;
    return tmp % 3;
}

}  // namespace

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

int Move(vi y) {
    if (B == 0) return Move1(y);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 15632 KB Output is correct
2 Correct 1 ms 1020 KB Output is correct
3 Correct 33 ms 15020 KB Output is correct
4 Correct 47 ms 16920 KB Output is correct
5 Correct 46 ms 16844 KB Output is correct
6 Correct 35 ms 15604 KB Output is correct
7 Correct 34 ms 15580 KB Output is correct
8 Correct 44 ms 16352 KB Output is correct
9 Correct 41 ms 16260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 15632 KB Output is correct
2 Correct 1 ms 1020 KB Output is correct
3 Correct 33 ms 15020 KB Output is correct
4 Correct 47 ms 16920 KB Output is correct
5 Correct 46 ms 16844 KB Output is correct
6 Correct 35 ms 15604 KB Output is correct
7 Correct 34 ms 15580 KB Output is correct
8 Correct 44 ms 16352 KB Output is correct
9 Correct 41 ms 16260 KB Output is correct
10 Correct 32 ms 13564 KB Output is correct
11 Correct 31 ms 13624 KB Output is correct
12 Correct 31 ms 14040 KB Output is correct
13 Correct 31 ms 14060 KB Output is correct
14 Correct 35 ms 14184 KB Output is correct
15 Correct 38 ms 14780 KB Output is correct
16 Correct 41 ms 16840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 13388 KB Output is correct
2 Correct 1 ms 1028 KB Output is correct
3 Correct 28 ms 12852 KB Output is correct
4 Correct 45 ms 14704 KB Output is correct
5 Correct 55 ms 14724 KB Output is correct
6 Correct 35 ms 13304 KB Output is correct
7 Correct 36 ms 13380 KB Output is correct
8 Correct 45 ms 14068 KB Output is correct
9 Correct 39 ms 13912 KB Output is correct
10 Correct 36 ms 13760 KB Output is correct
11 Correct 36 ms 13864 KB Output is correct
12 Correct 40 ms 13720 KB Output is correct
13 Correct 40 ms 13812 KB Output is correct
14 Correct 41 ms 13964 KB Output is correct
15 Correct 41 ms 14040 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 13388 KB Output is correct
2 Correct 1 ms 1028 KB Output is correct
3 Correct 28 ms 12852 KB Output is correct
4 Correct 45 ms 14704 KB Output is correct
5 Correct 55 ms 14724 KB Output is correct
6 Correct 35 ms 13304 KB Output is correct
7 Correct 36 ms 13380 KB Output is correct
8 Correct 45 ms 14068 KB Output is correct
9 Correct 39 ms 13912 KB Output is correct
10 Correct 36 ms 13760 KB Output is correct
11 Correct 36 ms 13864 KB Output is correct
12 Correct 40 ms 13720 KB Output is correct
13 Correct 40 ms 13812 KB Output is correct
14 Correct 41 ms 13964 KB Output is correct
15 Correct 41 ms 14040 KB Output is correct
16 Correct 28 ms 11796 KB Output is correct
17 Correct 28 ms 11828 KB Output is correct
18 Correct 35 ms 12120 KB Output is correct
19 Correct 30 ms 12324 KB Output is correct
20 Correct 43 ms 12680 KB Output is correct
21 Correct 38 ms 12452 KB Output is correct
22 Correct 47 ms 14588 KB Output is correct
23 Correct 33 ms 12264 KB Output is correct
24 Correct 33 ms 12336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1020 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1276 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1276 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -