Submission #21540

# Submission time Handle Problem Language Result Execution time Memory
21540 2017-04-14T08:40:18 Z Ushio Broken Device (JOI17_broken_device) C++14
47 / 100
75 ms 4644 KB
#include "Annalib.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;

void Anna( int N, long long X, int K, int P[] ){
    vector<int> per(N + 1);
    srand(241417941L);
    for (int i = 0; i < N + 1; ++i) {
        per[i] = i;
    }
    for (int i = 0; i < N; ++i) {
        int pos = i + rand() % (N - i);
        swap(per[i], per[pos]);
    }
    int bit = 0;
    bool validity = true;
    vector<bool> bad(N + 1, false);
    bad[per[N]] = true;
    for (int i = 0; i < K; ++i) {
        bad[P[i]] = true;
    }
    for (int i = 0; i < N; ++i) {
        if (validity) {
            if (bad[per[i]] || (bad[per[i + 1]] && bit <= 59 && (X & (1LL << bit)))) {
                Set(per[i], 0);
                validity = true;
            } else {
                Set(per[i], 1);
                validity = false;
            }
        } else {
            if (bit <= 59) {
                if (X & (1LL << bit)) {
                    Set(per[i], 1);
                } else {
                    Set(per[i], 0);
                }
                bit++;
            } else {
                Set(per[i], 0);
            }
            validity = true;
        }
    }
    cerr << "In: " << X << endl;
}
#include "Brunolib.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;

long long Bruno( int N, int A[] ){
    vector<int> per(N + 1);
    srand(241417941L);
    for (int i = 0; i < N + 1; ++i) {
        per[i] = i;
    }
    for (int i = 0; i < N; ++i) {
        int pos = i + rand() % (N - i);
        swap(per[i], per[pos]);
    }
    bool validity = true;
    int bit = 0;
    int64_t ans = 0;
    for (int i = 0; i < N; ++i) {
        if (validity) {
            validity = A[per[i]] == 0;
        } else {
            if (bit <= 59) {
                ans |= ((int64_t) A[per[i]]) << bit;
                ++bit;
            }
            validity = true;
        }
    }
    cerr << "Out: " << ans << endl;
    return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 25 ms 4644 KB Output is partially correct - L* = 23
2 Partially correct 32 ms 4644 KB Output is partially correct - L* = 21
3 Partially correct 48 ms 4644 KB Output is partially correct - L* = 24
4 Partially correct 45 ms 4644 KB Output is partially correct - L* = 23
5 Partially correct 45 ms 4644 KB Output is partially correct - L* = 21
6 Partially correct 46 ms 4644 KB Output is partially correct - L* = 20
7 Partially correct 35 ms 4644 KB Output is partially correct - L* = 23
8 Partially correct 28 ms 4644 KB Output is partially correct - L* = 24
9 Partially correct 55 ms 4644 KB Output is partially correct - L* = 19
10 Partially correct 38 ms 4644 KB Output is partially correct - L* = 22
11 Partially correct 42 ms 4644 KB Output is partially correct - L* = 22
12 Partially correct 58 ms 4644 KB Output is partially correct - L* = 22
13 Partially correct 45 ms 4644 KB Output is partially correct - L* = 21
14 Partially correct 41 ms 4644 KB Output is partially correct - L* = 18
15 Partially correct 49 ms 4644 KB Output is partially correct - L* = 24
16 Partially correct 49 ms 4644 KB Output is partially correct - L* = 22
17 Partially correct 68 ms 4644 KB Output is partially correct - L* = 21
18 Partially correct 36 ms 4644 KB Output is partially correct - L* = 22
19 Partially correct 72 ms 4644 KB Output is partially correct - L* = 22
20 Partially correct 39 ms 4644 KB Output is partially correct - L* = 23
21 Partially correct 48 ms 4644 KB Output is partially correct - L* = 21
22 Partially correct 52 ms 4644 KB Output is partially correct - L* = 21
23 Partially correct 57 ms 4644 KB Output is partially correct - L* = 22
24 Partially correct 52 ms 4644 KB Output is partially correct - L* = 22
25 Partially correct 52 ms 4644 KB Output is partially correct - L* = 24
26 Partially correct 54 ms 4644 KB Output is partially correct - L* = 23
27 Partially correct 48 ms 4644 KB Output is partially correct - L* = 20
28 Partially correct 46 ms 4644 KB Output is partially correct - L* = 21
29 Partially correct 75 ms 4644 KB Output is partially correct - L* = 23
30 Partially correct 62 ms 4644 KB Output is partially correct - L* = 22
31 Partially correct 39 ms 4644 KB Output is partially correct - L* = 22
32 Partially correct 46 ms 4644 KB Output is partially correct - L* = 23
33 Partially correct 62 ms 4644 KB Output is partially correct - L* = 22
34 Partially correct 59 ms 4644 KB Output is partially correct - L* = 21
35 Partially correct 49 ms 4644 KB Output is partially correct - L* = 24
36 Partially correct 55 ms 4644 KB Output is partially correct - L* = 22
37 Partially correct 46 ms 4644 KB Output is partially correct - L* = 22
38 Partially correct 62 ms 4644 KB Output is partially correct - L* = 23
39 Partially correct 38 ms 4644 KB Output is partially correct - L* = 24
40 Partially correct 49 ms 4644 KB Output is partially correct - L* = 18