Submission #994402

# Submission time Handle Problem Language Result Execution time Memory
994402 2024-06-07T14:28:49 Z Sharky Broken Device (JOI17_broken_device) C++17
85 / 100
60 ms 3080 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

namespace anna {
const long long purple = 694202512019219198LL;
const int amogus = 696969;

mt19937 rng(amogus);
vector<int> p(151), inv(151);

int rnd(int u, int v) {
    return uniform_int_distribution<int> (u, v) (rng);
}

void gen_perm() {
    for (int i = 0; i < 150; i++) p[i] = i;
    for (int i = 0; i < 150; i++) swap(p[rnd(0, 149)], p[rnd(0, 149)]);
    for (int i = 0; i < 150; i++) inv[p[i]] = i;
}
}

using namespace anna;

void Anna(int N, long long _X, int K, int _P[]){
    gen_perm();
    long long X = _X;
    // X ^= purple;
    vector<int> P, seq(N);
    set<int> broken;
    for (int i = 0; i < K; i++) {
        P.push_back(p[_P[i]]);
        broken.insert(P.back());
    }
    for (int i = 0; i < N; i += 2) {
        if (broken.count(i) || broken.count(i + 1) || X == 0) seq[i] = seq[i + 1] = 0;
        else {
            int b = X % 3;
            if (b == 0) seq[i] = 0, seq[i + 1] = 1;
            else if (b == 1) seq[i] = 1, seq[i + 1] = 0;
            else seq[i] = 1, seq[i + 1] = 1;
            X /= 3;
        }
    }
    for (int i = 0; i < N; i++) Set(inv[i], seq[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

namespace bruno {
const long long purple = 694202512019219198LL;
const int amogus = 696969;

mt19937 rng(amogus);
vector<int> p(151), inv(151);

int rnd(int u, int v) {
    return uniform_int_distribution<int> (u, v) (rng);
}

void gen_perm() {
    for (int i = 0; i < 150; i++) p[i] = i;
    for (int i = 0; i < 150; i++) swap(p[rnd(0, 149)], p[rnd(0, 149)]);
    for (int i = 0; i < 150; i++) inv[p[i]] = i;
}
}

using namespace bruno;

long long Bruno(int N, int A[]) {
    gen_perm();
    long long X = 0;
    vector<int> a(N);
    for (int i = 0; i < N; i++) a[i] = A[inv[i]];
    for (int i = N - 2; i >= 0; i -= 2) {
        int b1 = a[i], b2 = a[i + 1];
        if (b1 || b2) X *= 3;
        if (b1 == 0 && b2 == 1) X += 0;
        else if (b1 == 1 && b2 == 0) X += 1;
        else if (b1 == 1 && b2 == 1) X += 2;
    }
    // X ^= purple;
    return X;
}
# Verdict Execution time Memory Grader output
1 Partially correct 36 ms 2776 KB Output is partially correct - L* = 39
2 Partially correct 31 ms 2732 KB Output is partially correct - L* = 39
3 Partially correct 33 ms 2780 KB Output is partially correct - L* = 38
4 Partially correct 32 ms 2732 KB Output is partially correct - L* = 39
5 Partially correct 32 ms 2752 KB Output is partially correct - L* = 38
6 Partially correct 31 ms 2764 KB Output is partially correct - L* = 39
7 Partially correct 38 ms 2756 KB Output is partially correct - L* = 38
8 Partially correct 32 ms 2848 KB Output is partially correct - L* = 38
9 Partially correct 34 ms 2776 KB Output is partially correct - L* = 39
10 Correct 34 ms 2764 KB Output is correct - L* = 40
11 Partially correct 32 ms 2876 KB Output is partially correct - L* = 38
12 Partially correct 32 ms 2752 KB Output is partially correct - L* = 39
13 Partially correct 32 ms 2772 KB Output is partially correct - L* = 38
14 Partially correct 32 ms 2772 KB Output is partially correct - L* = 38
15 Partially correct 34 ms 2748 KB Output is partially correct - L* = 38
16 Partially correct 34 ms 2772 KB Output is partially correct - L* = 38
17 Partially correct 32 ms 2752 KB Output is partially correct - L* = 38
18 Partially correct 32 ms 2804 KB Output is partially correct - L* = 37
19 Partially correct 30 ms 2876 KB Output is partially correct - L* = 39
20 Partially correct 34 ms 2744 KB Output is partially correct - L* = 38
21 Partially correct 33 ms 2836 KB Output is partially correct - L* = 38
22 Partially correct 30 ms 2936 KB Output is partially correct - L* = 39
23 Partially correct 31 ms 2724 KB Output is partially correct - L* = 38
24 Partially correct 34 ms 2872 KB Output is partially correct - L* = 37
25 Partially correct 34 ms 2784 KB Output is partially correct - L* = 38
26 Partially correct 35 ms 2744 KB Output is partially correct - L* = 38
27 Partially correct 52 ms 2752 KB Output is partially correct - L* = 39
28 Partially correct 36 ms 2656 KB Output is partially correct - L* = 38
29 Partially correct 36 ms 2676 KB Output is partially correct - L* = 38
30 Partially correct 33 ms 2628 KB Output is partially correct - L* = 37
31 Partially correct 60 ms 2748 KB Output is partially correct - L* = 38
32 Partially correct 33 ms 2688 KB Output is partially correct - L* = 39
33 Partially correct 45 ms 3080 KB Output is partially correct - L* = 37
34 Partially correct 32 ms 2748 KB Output is partially correct - L* = 39
35 Partially correct 47 ms 2744 KB Output is partially correct - L* = 38
36 Partially correct 31 ms 2840 KB Output is partially correct - L* = 38
37 Partially correct 30 ms 2840 KB Output is partially correct - L* = 38
38 Partially correct 30 ms 2748 KB Output is partially correct - L* = 39
39 Partially correct 31 ms 2680 KB Output is partially correct - L* = 37
40 Partially correct 34 ms 2768 KB Output is partially correct - L* = 39