Submission #97562

# Submission time Handle Problem Language Result Execution time Memory
97562 2019-02-17T03:58:09 Z silxikys Broken Device (JOI17_broken_device) C++14
85 / 100
71 ms 3096 KB
#include "Annalib.h"
#include <vector>

void Anna(int N, long long X, int K, int P[]) {
    int pos = 0;
    std::vector<int> ans(N,-1);
    std::vector<int> ternary;
    while (X) {
        int x = X % 3;
        ternary.push_back(x);
        X /= 3;
    }
    for (int i = 0; i < K; i++) {
        ans[P[i]] = 0;
    }
    for (int i = 0; i < N; i += 2) {
        if (ans[i] == 0 || ans[i+1] == 0) {
            ans[i] = 0;
            ans[i+1] = 0;
        }
        else {
            if (pos >= (int)ternary.size()) {
                ans[i] = 0;
                ans[i+1] = 0;
                continue;
            }
            if (ternary[pos] == 0) {
                ans[i] = 0;
                ans[i+1] = 1;
            }
            else if (ternary[pos] == 1) {
                ans[i] = 1;
                ans[i+1] = 0;
            }
            else {
                ans[i] = 1;
                ans[i+1] = 1;
            }
            pos++;
        }
    }
    for (int i = 0; i < N; i++) {
        //assert(ans[i] == 0 || ans[i] == 1);
        Set(i,ans[i]);            
    }
}
#include "Brunolib.h"
#include <vector>

long long Bruno(int N, int A[]) {
    long long ans = 0;
    long long mult = 1;
    for (int i = 0; i < N; i += 2) {
        int r = A[i] * 2 + A[i+1];
        if (r == 0) continue;
        else if (r == 1) {
            ans += mult * 0;
        }
        else if (r == 2) {
            ans += mult * 1;
        }
        else {
            ans += mult * 2;
        }
        mult *= 3;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 53 ms 3056 KB Output is partially correct - L* = 37
2 Partially correct 62 ms 3056 KB Output is partially correct - L* = 37
3 Partially correct 43 ms 3056 KB Output is partially correct - L* = 37
4 Partially correct 51 ms 3056 KB Output is partially correct - L* = 37
5 Partially correct 49 ms 3072 KB Output is partially correct - L* = 37
6 Partially correct 44 ms 3072 KB Output is partially correct - L* = 37
7 Partially correct 46 ms 2816 KB Output is partially correct - L* = 37
8 Partially correct 51 ms 2808 KB Output is partially correct - L* = 37
9 Partially correct 70 ms 3048 KB Output is partially correct - L* = 37
10 Partially correct 52 ms 2816 KB Output is partially correct - L* = 37
11 Partially correct 57 ms 2800 KB Output is partially correct - L* = 37
12 Partially correct 50 ms 3016 KB Output is partially correct - L* = 37
13 Partially correct 51 ms 3056 KB Output is partially correct - L* = 37
14 Partially correct 39 ms 2816 KB Output is partially correct - L* = 37
15 Partially correct 60 ms 3056 KB Output is partially correct - L* = 37
16 Partially correct 61 ms 3056 KB Output is partially correct - L* = 37
17 Partially correct 51 ms 3056 KB Output is partially correct - L* = 37
18 Partially correct 52 ms 3096 KB Output is partially correct - L* = 37
19 Partially correct 43 ms 2800 KB Output is partially correct - L* = 37
20 Partially correct 41 ms 2816 KB Output is partially correct - L* = 37
21 Partially correct 55 ms 2936 KB Output is partially correct - L* = 37
22 Partially correct 43 ms 3056 KB Output is partially correct - L* = 37
23 Partially correct 54 ms 3056 KB Output is partially correct - L* = 37
24 Partially correct 68 ms 3056 KB Output is partially correct - L* = 37
25 Partially correct 43 ms 2816 KB Output is partially correct - L* = 37
26 Partially correct 47 ms 3056 KB Output is partially correct - L* = 37
27 Partially correct 65 ms 2800 KB Output is partially correct - L* = 37
28 Partially correct 59 ms 2816 KB Output is partially correct - L* = 37
29 Partially correct 46 ms 3056 KB Output is partially correct - L* = 37
30 Partially correct 45 ms 2816 KB Output is partially correct - L* = 37
31 Partially correct 54 ms 2552 KB Output is partially correct - L* = 37
32 Partially correct 71 ms 2800 KB Output is partially correct - L* = 37
33 Partially correct 45 ms 2800 KB Output is partially correct - L* = 37
34 Partially correct 63 ms 2816 KB Output is partially correct - L* = 37
35 Partially correct 46 ms 2800 KB Output is partially correct - L* = 37
36 Partially correct 54 ms 2800 KB Output is partially correct - L* = 37
37 Partially correct 59 ms 2800 KB Output is partially correct - L* = 37
38 Partially correct 44 ms 2800 KB Output is partially correct - L* = 37
39 Partially correct 45 ms 2800 KB Output is partially correct - L* = 37
40 Partially correct 60 ms 3056 KB Output is partially correct - L* = 37