Submission #97560

# Submission time Handle Problem Language Result Execution time Memory
97560 2019-02-17T03:49:36 Z silxikys Broken Device (JOI17_broken_device) C++14
41 / 100
67 ms 3072 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);
    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 > 61) {
                ans[i] = 0;
                ans[i+1] = 0;
                continue;
            }
            if (X & (1LL<<pos)) {
                ans[i] = 1;
                ans[i+1] = 1;
            }
            else {
                ans[i] = 0;
                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[]) {
    std::vector<int> ans;
    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.push_back(0);
        }
        else {
            ans.push_back(1);
        }
    }
    long long res = 0;
    for (int i = 0; i < ans.size(); i++) {
        if (ans[i] == 1) {
            res += (1LL<<i);
        }
    }
    return res;
}

Compilation message

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:17:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < ans.size(); i++) {
                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 48 ms 2816 KB Output is partially correct - L* = 15
2 Partially correct 49 ms 2816 KB Output is partially correct - L* = 15
3 Partially correct 53 ms 3056 KB Output is partially correct - L* = 16
4 Partially correct 55 ms 3072 KB Output is partially correct - L* = 15
5 Partially correct 56 ms 2816 KB Output is partially correct - L* = 15
6 Partially correct 41 ms 3072 KB Output is partially correct - L* = 15
7 Partially correct 56 ms 3056 KB Output is partially correct - L* = 15
8 Partially correct 63 ms 2632 KB Output is partially correct - L* = 15
9 Partially correct 48 ms 2816 KB Output is partially correct - L* = 16
10 Partially correct 57 ms 3056 KB Output is partially correct - L* = 16
11 Partially correct 52 ms 2800 KB Output is partially correct - L* = 15
12 Partially correct 58 ms 2968 KB Output is partially correct - L* = 16
13 Partially correct 57 ms 2816 KB Output is partially correct - L* = 15
14 Partially correct 47 ms 3008 KB Output is partially correct - L* = 15
15 Partially correct 67 ms 3056 KB Output is partially correct - L* = 15
16 Partially correct 43 ms 2816 KB Output is partially correct - L* = 15
17 Partially correct 64 ms 3056 KB Output is partially correct - L* = 15
18 Partially correct 57 ms 2816 KB Output is partially correct - L* = 15
19 Partially correct 43 ms 3072 KB Output is partially correct - L* = 16
20 Partially correct 47 ms 2816 KB Output is partially correct - L* = 15
21 Partially correct 46 ms 2856 KB Output is partially correct - L* = 15
22 Partially correct 60 ms 3056 KB Output is partially correct - L* = 15
23 Partially correct 53 ms 3000 KB Output is partially correct - L* = 15
24 Partially correct 66 ms 3056 KB Output is partially correct - L* = 15
25 Partially correct 56 ms 3056 KB Output is partially correct - L* = 15
26 Partially correct 62 ms 3056 KB Output is partially correct - L* = 15
27 Partially correct 57 ms 2560 KB Output is partially correct - L* = 15
28 Partially correct 60 ms 3056 KB Output is partially correct - L* = 15
29 Partially correct 53 ms 3056 KB Output is partially correct - L* = 15
30 Partially correct 45 ms 3072 KB Output is partially correct - L* = 15
31 Partially correct 53 ms 2800 KB Output is partially correct - L* = 15
32 Partially correct 60 ms 3056 KB Output is partially correct - L* = 16
33 Partially correct 56 ms 2872 KB Output is partially correct - L* = 15
34 Partially correct 64 ms 3056 KB Output is partially correct - L* = 15
35 Partially correct 44 ms 3056 KB Output is partially correct - L* = 15
36 Partially correct 63 ms 2816 KB Output is partially correct - L* = 15
37 Partially correct 67 ms 3040 KB Output is partially correct - L* = 16
38 Partially correct 44 ms 3056 KB Output is partially correct - L* = 15
39 Partially correct 59 ms 2800 KB Output is partially correct - L* = 15
40 Partially correct 59 ms 2800 KB Output is partially correct - L* = 15