Submission #21547

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

const int FCT = 3;

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

const int FCT = 3;

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]);
    }
    int validity = 0;
    int bit = 0;
    int64_t ans = 0;
    for (int i = 0; i < N; ++i) {
        if (validity == 0) {
            validity = A[per[i]] * FCT;
        } else {
            if (bit <= 59) {
                ans |= ((int64_t) A[per[i]]) << bit;
                ++bit;
            }
            validity--;
        }
    }
    cerr << "Out: " << ans << endl;
    return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 59 ms 4644 KB Output is partially correct - L* = 26
2 Partially correct 59 ms 4644 KB Output is partially correct - L* = 25
3 Partially correct 65 ms 4644 KB Output is partially correct - L* = 29
4 Partially correct 49 ms 4644 KB Output is partially correct - L* = 22
5 Partially correct 65 ms 4644 KB Output is partially correct - L* = 24
6 Partially correct 62 ms 4644 KB Output is partially correct - L* = 25
7 Partially correct 41 ms 4644 KB Output is partially correct - L* = 28
8 Partially correct 41 ms 4644 KB Output is partially correct - L* = 27
9 Partially correct 49 ms 4644 KB Output is partially correct - L* = 21
10 Partially correct 49 ms 4644 KB Output is partially correct - L* = 26
11 Partially correct 52 ms 4644 KB Output is partially correct - L* = 25
12 Partially correct 55 ms 4644 KB Output is partially correct - L* = 27
13 Partially correct 41 ms 4644 KB Output is partially correct - L* = 26
14 Partially correct 48 ms 4644 KB Output is partially correct - L* = 26
15 Partially correct 38 ms 4644 KB Output is partially correct - L* = 25
16 Partially correct 41 ms 4644 KB Output is partially correct - L* = 25
17 Partially correct 55 ms 4644 KB Output is partially correct - L* = 28
18 Partially correct 45 ms 4644 KB Output is partially correct - L* = 24
19 Partially correct 62 ms 4644 KB Output is partially correct - L* = 28
20 Partially correct 46 ms 4644 KB Output is partially correct - L* = 24
21 Partially correct 69 ms 4644 KB Output is partially correct - L* = 27
22 Partially correct 59 ms 4644 KB Output is partially correct - L* = 27
23 Partially correct 68 ms 4644 KB Output is partially correct - L* = 27
24 Partially correct 69 ms 4644 KB Output is partially correct - L* = 24
25 Partially correct 56 ms 4644 KB Output is partially correct - L* = 27
26 Partially correct 65 ms 4644 KB Output is partially correct - L* = 26
27 Partially correct 59 ms 4644 KB Output is partially correct - L* = 27
28 Partially correct 56 ms 4644 KB Output is partially correct - L* = 28
29 Partially correct 62 ms 4644 KB Output is partially correct - L* = 25
30 Partially correct 49 ms 4644 KB Output is partially correct - L* = 26
31 Partially correct 55 ms 4644 KB Output is partially correct - L* = 27
32 Partially correct 69 ms 4644 KB Output is partially correct - L* = 25
33 Partially correct 59 ms 4644 KB Output is partially correct - L* = 25
34 Partially correct 52 ms 4644 KB Output is partially correct - L* = 27
35 Partially correct 56 ms 4644 KB Output is partially correct - L* = 24
36 Partially correct 38 ms 4644 KB Output is partially correct - L* = 27
37 Partially correct 62 ms 4644 KB Output is partially correct - L* = 28
38 Partially correct 46 ms 4644 KB Output is partially correct - L* = 28
39 Partially correct 45 ms 4644 KB Output is partially correct - L* = 27
40 Partially correct 35 ms 4644 KB Output is partially correct - L* = 27