답안 #1029796

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1029796 2024-07-21T10:39:25 Z borisAngelov Broken Device (JOI17_broken_device) C++17
41 / 100
42 ms 3164 KB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;

int n, k;
long long x;
bool isBlocked[200];

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

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

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

    long long bit = 0;

    for (int i = 0; i < n; ++i)
    {
        if (bit == 60)
        {
            Set(i, 0);
            continue;
        }

        if (i < n - 1 && isBlocked[i] == false && isBlocked[i + 1] == false)
        {
            if ((x & (1LL << bit)) != 0)
            {
                Set(i, 1);
            }
            else
            {
                Set(i, 0);
            }

            Set(i + 1, 1);
            ++i;
            ++bit;
        }
        else
        {
            Set(i, 0);
        }
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

int a[200];

long long Bruno(int N, int A[])
{
    int n = N;

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

    /*for (int i = 0; i < n; ++i)
    {
        cout << a[i] << " ";
    }

    cout << endl;*/

    long long ans = 0;
    long long bit = 0;

    for (int i = 0; i < n; ++i)
    {
        if (a[i] == 1)
        {
            int cnt = 1, from = i;

            while (i + 1 < n && a[i + 1] == 1)
            {
                ++cnt;
                ++i;
            }

            if (cnt % 2 == 1)
            {
                ++from;
                ++bit;
            }

            for (int j = from; j <= i; j += 2)
            {
                ans += (1LL << bit);
                ++bit;
            }

            //cout << from << " " << i << " :: " << ans << endl;
        }
    }

    //cout << ans << endl;

    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 20 ms 2772 KB Output is partially correct - L* = 15
2 Partially correct 30 ms 2988 KB Output is partially correct - L* = 15
3 Partially correct 20 ms 2772 KB Output is partially correct - L* = 17
4 Partially correct 33 ms 2748 KB Output is partially correct - L* = 16
5 Partially correct 42 ms 2776 KB Output is partially correct - L* = 15
6 Partially correct 20 ms 2776 KB Output is partially correct - L* = 15
7 Partially correct 20 ms 2776 KB Output is partially correct - L* = 18
8 Partially correct 26 ms 2776 KB Output is partially correct - L* = 18
9 Partially correct 20 ms 3164 KB Output is partially correct - L* = 16
10 Partially correct 22 ms 2776 KB Output is partially correct - L* = 16
11 Partially correct 20 ms 2776 KB Output is partially correct - L* = 17
12 Partially correct 20 ms 2784 KB Output is partially correct - L* = 17
13 Partially correct 20 ms 2828 KB Output is partially correct - L* = 15
14 Partially correct 23 ms 2772 KB Output is partially correct - L* = 15
15 Partially correct 20 ms 2772 KB Output is partially correct - L* = 16
16 Partially correct 23 ms 2776 KB Output is partially correct - L* = 15
17 Partially correct 20 ms 2716 KB Output is partially correct - L* = 17
18 Partially correct 30 ms 2772 KB Output is partially correct - L* = 16
19 Partially correct 26 ms 2784 KB Output is partially correct - L* = 18
20 Partially correct 27 ms 2772 KB Output is partially correct - L* = 15
21 Partially correct 20 ms 2772 KB Output is partially correct - L* = 15
22 Partially correct 27 ms 2748 KB Output is partially correct - L* = 15
23 Partially correct 27 ms 2816 KB Output is partially correct - L* = 15
24 Partially correct 25 ms 2744 KB Output is partially correct - L* = 17
25 Partially correct 27 ms 2776 KB Output is partially correct - L* = 15
26 Partially correct 23 ms 2776 KB Output is partially correct - L* = 16
27 Partially correct 23 ms 2884 KB Output is partially correct - L* = 15
28 Partially correct 27 ms 2696 KB Output is partially correct - L* = 16
29 Partially correct 22 ms 2804 KB Output is partially correct - L* = 15
30 Partially correct 20 ms 2884 KB Output is partially correct - L* = 16
31 Partially correct 27 ms 2768 KB Output is partially correct - L* = 15
32 Partially correct 32 ms 2744 KB Output is partially correct - L* = 16
33 Partially correct 20 ms 2980 KB Output is partially correct - L* = 15
34 Partially correct 20 ms 2772 KB Output is partially correct - L* = 16
35 Partially correct 32 ms 2688 KB Output is partially correct - L* = 15
36 Partially correct 20 ms 2772 KB Output is partially correct - L* = 15
37 Partially correct 20 ms 2772 KB Output is partially correct - L* = 16
38 Partially correct 26 ms 2792 KB Output is partially correct - L* = 17
39 Partially correct 20 ms 2768 KB Output is partially correct - L* = 15
40 Partially correct 20 ms 2812 KB Output is partially correct - L* = 15