답안 #334056

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
334056 2020-12-08T08:09:16 Z dolphingarlic Broken Device (JOI17_broken_device) C++14
51 / 100
51 ms 3096 KB
#include "Annalib.h"

void Anna(int N, long long X, int K, int P[]) {
    bool broken[150];
    for (int i = 0; i < N; i++) broken[i] = false;
    for (int i = 0; i < K; i++) broken[P[i]] = true;

    for (int i = 0, j = 0; i < N; i += 3) {
        if (j > 60 || broken[i] || broken[i + 1] || broken[i + 2]) {
            Set(i, 0); Set(i + 1, 0); Set(i + 2, 0);
        } else {
            Set(i, 1);
            Set(i + 1, (X & (1ll << j)) >> j);
            Set(i + 2, (X & (1ll << j + 1)) >> j + 1);
            j += 2;
        }
    }
}
#include "Brunolib.h"

long long Bruno(int N, int A[]) {
    long long ans = 0;
    for (int i = 0, j = 0; i < N && j <= 60; i += 3) {
        if (A[i]) {
            ans += A[i + 1] * (1ll << j) + A[i + 2] * (1ll << j + 1);
            j += 2;
        }
    }
    return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:14:39: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   14 |             Set(i + 2, (X & (1ll << j + 1)) >> j + 1);
      |                                     ~~^~~
Anna.cpp:14:50: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   14 |             Set(i + 2, (X & (1ll << j + 1)) >> j + 1);
      |                                                ~~^~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:7:65: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
    7 |             ans += A[i + 1] * (1ll << j) + A[i + 2] * (1ll << j + 1);
      |                                                               ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 38 ms 2860 KB Output is partially correct - L* = 20
2 Partially correct 43 ms 2712 KB Output is partially correct - L* = 20
3 Partially correct 38 ms 2712 KB Output is partially correct - L* = 20
4 Partially correct 38 ms 2620 KB Output is partially correct - L* = 20
5 Partially correct 38 ms 2720 KB Output is partially correct - L* = 20
6 Partially correct 38 ms 2712 KB Output is partially correct - L* = 20
7 Partially correct 49 ms 2712 KB Output is partially correct - L* = 20
8 Partially correct 38 ms 2720 KB Output is partially correct - L* = 20
9 Partially correct 38 ms 2748 KB Output is partially correct - L* = 20
10 Partially correct 38 ms 2840 KB Output is partially correct - L* = 21
11 Partially correct 38 ms 2720 KB Output is partially correct - L* = 20
12 Partially correct 38 ms 2620 KB Output is partially correct - L* = 21
13 Partially correct 39 ms 2848 KB Output is partially correct - L* = 20
14 Partially correct 40 ms 2692 KB Output is partially correct - L* = 20
15 Partially correct 38 ms 2492 KB Output is partially correct - L* = 20
16 Partially correct 38 ms 2712 KB Output is partially correct - L* = 21
17 Partially correct 38 ms 2712 KB Output is partially correct - L* = 20
18 Partially correct 38 ms 2968 KB Output is partially correct - L* = 20
19 Partially correct 43 ms 2620 KB Output is partially correct - L* = 20
20 Partially correct 50 ms 2492 KB Output is partially correct - L* = 20
21 Partially correct 38 ms 2620 KB Output is partially correct - L* = 20
22 Partially correct 38 ms 2720 KB Output is partially correct - L* = 20
23 Partially correct 38 ms 2752 KB Output is partially correct - L* = 20
24 Partially correct 46 ms 2536 KB Output is partially correct - L* = 21
25 Partially correct 38 ms 2840 KB Output is partially correct - L* = 21
26 Partially correct 38 ms 2668 KB Output is partially correct - L* = 20
27 Partially correct 38 ms 2492 KB Output is partially correct - L* = 20
28 Partially correct 40 ms 2712 KB Output is partially correct - L* = 20
29 Partially correct 44 ms 2868 KB Output is partially correct - L* = 20
30 Partially correct 38 ms 2712 KB Output is partially correct - L* = 20
31 Partially correct 48 ms 2492 KB Output is partially correct - L* = 20
32 Partially correct 47 ms 2492 KB Output is partially correct - L* = 20
33 Partially correct 40 ms 2624 KB Output is partially correct - L* = 20
34 Partially correct 40 ms 2660 KB Output is partially correct - L* = 20
35 Partially correct 38 ms 2492 KB Output is partially correct - L* = 20
36 Partially correct 38 ms 2748 KB Output is partially correct - L* = 20
37 Partially correct 38 ms 2492 KB Output is partially correct - L* = 20
38 Partially correct 38 ms 2620 KB Output is partially correct - L* = 20
39 Partially correct 41 ms 2712 KB Output is partially correct - L* = 21
40 Partially correct 51 ms 3096 KB Output is partially correct - L* = 21