답안 #1029906

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1029906 2024-07-21T13:36:28 Z borisAngelov Broken Device (JOI17_broken_device) C++17
85 / 100
37 ms 3020 KB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;

void Anna(int N, long long X, int K, int P[])
{
    int n = N;
    long long x = X;
    int k = K;

    bool isBlocked[n + 1] = {};

    for (int i = 0; i < n; ++i)
    {
        isBlocked[i] = false;
    }

    for (int i = 0; i < k; ++i)
    {
        isBlocked[P[i]] = true;
    }

    for (int i = 0; i < n / 2; ++i)
    {
        int digit = x % 3;

        int pos1 = 2 * i;
        int pos2 = 2 * i + 1;
        bool flag = false;

        if (digit == 0 && isBlocked[pos1] == false)
        {
            Set(pos1, 1);
            Set(pos2, 0);
            flag = true;
        }

        if (digit == 1 && isBlocked[pos2] == false)
        {
            Set(pos1, 0);
            Set(pos2, 1);
            flag = true;
        }

        if (digit == 2 && isBlocked[pos1] == false && isBlocked[pos2] == false)
        {
            Set(pos1, 1);
            Set(pos2, 1);
            flag = true;
        }

        if (flag == false)
        {
            Set(pos1, 0);
            Set(pos2, 0);
        }
        else
        {
            x /= 3;
        }
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

long long Bruno(int N, int A[])
{
    int n = N;
    int a[n + 1] = {};

    for (int i = 0; i < n; ++i)
    {
        a[i] = A[i];
    }

    long long ans = 0;
    long long curr = 1;

    for (int i = 0; i < n / 2; ++i)
    {
        int pos1 = 2 * i;
        int pos2 = 2 * i + 1;

        if (a[pos1] + a[pos2] == 0) continue;

        if (a[pos1] == 0 && a[pos2] == 1)
        {
            ans += curr;
        }

        if (a[pos1] == 1 && a[pos2] == 1)
        {
            ans += 2 * curr;
        }

        curr *= 3;
    }

    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 32 ms 3020 KB Output is partially correct - L* = 37
2 Partially correct 20 ms 2816 KB Output is partially correct - L* = 37
3 Partially correct 28 ms 2780 KB Output is partially correct - L* = 37
4 Partially correct 29 ms 2856 KB Output is partially correct - L* = 37
5 Partially correct 22 ms 2776 KB Output is partially correct - L* = 37
6 Partially correct 32 ms 2780 KB Output is partially correct - L* = 37
7 Partially correct 26 ms 2708 KB Output is partially correct - L* = 37
8 Partially correct 27 ms 2740 KB Output is partially correct - L* = 37
9 Partially correct 28 ms 2868 KB Output is partially correct - L* = 37
10 Partially correct 34 ms 2856 KB Output is partially correct - L* = 37
11 Partially correct 20 ms 2864 KB Output is partially correct - L* = 37
12 Partially correct 26 ms 2744 KB Output is partially correct - L* = 37
13 Partially correct 24 ms 2772 KB Output is partially correct - L* = 37
14 Partially correct 33 ms 2872 KB Output is partially correct - L* = 37
15 Partially correct 27 ms 2824 KB Output is partially correct - L* = 37
16 Partially correct 37 ms 2692 KB Output is partially correct - L* = 37
17 Partially correct 23 ms 2848 KB Output is partially correct - L* = 37
18 Partially correct 26 ms 2728 KB Output is partially correct - L* = 37
19 Partially correct 27 ms 2848 KB Output is partially correct - L* = 37
20 Partially correct 30 ms 2868 KB Output is partially correct - L* = 37
21 Partially correct 30 ms 2860 KB Output is partially correct - L* = 37
22 Partially correct 30 ms 2888 KB Output is partially correct - L* = 37
23 Partially correct 28 ms 2828 KB Output is partially correct - L* = 37
24 Partially correct 26 ms 2844 KB Output is partially correct - L* = 37
25 Partially correct 27 ms 2620 KB Output is partially correct - L* = 37
26 Partially correct 29 ms 2976 KB Output is partially correct - L* = 37
27 Partially correct 34 ms 2860 KB Output is partially correct - L* = 37
28 Partially correct 27 ms 2724 KB Output is partially correct - L* = 37
29 Partially correct 30 ms 2788 KB Output is partially correct - L* = 37
30 Partially correct 23 ms 2772 KB Output is partially correct - L* = 37
31 Partially correct 20 ms 2848 KB Output is partially correct - L* = 38
32 Partially correct 25 ms 2784 KB Output is partially correct - L* = 37
33 Partially correct 32 ms 2776 KB Output is partially correct - L* = 37
34 Partially correct 26 ms 2768 KB Output is partially correct - L* = 37
35 Partially correct 20 ms 2776 KB Output is partially correct - L* = 37
36 Partially correct 26 ms 2684 KB Output is partially correct - L* = 37
37 Partially correct 26 ms 2696 KB Output is partially correct - L* = 37
38 Partially correct 20 ms 2716 KB Output is partially correct - L* = 37
39 Partially correct 20 ms 2860 KB Output is partially correct - L* = 37
40 Partially correct 24 ms 2696 KB Output is partially correct - L* = 37