답안 #561950

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
561950 2022-05-13T23:05:30 Z aryan12 Broken Device (JOI17_broken_device) C++17
0 / 100
33 ms 2968 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

void Anna(int N, long long X, int K, int P[])
{
    set<int> already_taken;
    for(int i = 0; i < K; i++)
    {
        already_taken.insert(P[i]);
    }
    long long cnt = 0;
    // cout << "X = " << X << "\n";
    for(long long i = 0; i < N / 2; i++)
    {
        long long bit_set = (1LL << cnt) & X;
        // cout << "bit_set = " << bit_set << "\n";
        cnt++;
        if(bit_set == 0 && !already_taken.count(i * 2) && !already_taken.count(i * 2 + 1))
        {
            Set(i * 2, 1);
            Set(i * 2 + 1, 1);
        }
        else if(bit_set != 0 && !already_taken.count(i * 2))
        {
            Set(i * 2, 1);
            Set(i * 2 + 1, 0);
        }
        else if(bit_set != 0 && !already_taken.count(i * 2 + 1))
        {
            Set(i * 2, 0);
            Set(i * 2 + 1, 1);
        }
        else
        {
            cnt--;
            Set(i * 2, 0);
            Set(i * 2 + 1, 0);
        }
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

long long Bruno(int N, int A[])
{
    // for(long long i = 0; i < N; i++)
    // {
    //     cout << A[i] << " ";
    // }
    // cout << "\n";
    long long ans = 0, cur_bit = 0;
    for(int i = 0; i < N - 1; i += 2)
    {
        if(A[i] == 0 && A[i + 1] == 0)
        {
            continue;
        }
        if(A[i] == 0 || A[i + 1] == 0)
        {
            ans += (1LL << cur_bit);
        }
        cur_bit++;
    }
    // cout << "ans = " << ans << "\n";
    assert(ans % 2 == 0);
    return ans / 2;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 25 ms 2568 KB Execution killed with signal 6
2 Runtime error 25 ms 2632 KB Execution killed with signal 6
3 Runtime error 23 ms 2636 KB Execution killed with signal 6
4 Runtime error 23 ms 2732 KB Execution killed with signal 6
5 Runtime error 24 ms 2552 KB Execution killed with signal 6
6 Runtime error 25 ms 2752 KB Execution killed with signal 6
7 Runtime error 24 ms 2708 KB Execution killed with signal 6
8 Runtime error 23 ms 2572 KB Execution killed with signal 6
9 Runtime error 23 ms 2756 KB Execution killed with signal 6
10 Runtime error 26 ms 2720 KB Execution killed with signal 6
11 Runtime error 22 ms 2616 KB Execution killed with signal 6
12 Runtime error 23 ms 2720 KB Execution killed with signal 6
13 Runtime error 23 ms 2816 KB Execution killed with signal 6
14 Runtime error 29 ms 2560 KB Execution killed with signal 6
15 Runtime error 33 ms 2768 KB Execution killed with signal 6
16 Runtime error 23 ms 2660 KB Execution killed with signal 6
17 Runtime error 23 ms 2684 KB Execution killed with signal 6
18 Runtime error 24 ms 2764 KB Execution killed with signal 6
19 Runtime error 24 ms 2600 KB Execution killed with signal 6
20 Runtime error 24 ms 2696 KB Execution killed with signal 6
21 Runtime error 25 ms 2748 KB Execution killed with signal 6
22 Runtime error 32 ms 2604 KB Execution killed with signal 6
23 Runtime error 25 ms 2720 KB Execution killed with signal 6
24 Runtime error 23 ms 2648 KB Execution killed with signal 6
25 Runtime error 23 ms 2804 KB Execution killed with signal 6
26 Runtime error 26 ms 2652 KB Execution killed with signal 6
27 Runtime error 25 ms 2736 KB Execution killed with signal 6
28 Runtime error 27 ms 2608 KB Execution killed with signal 6
29 Runtime error 24 ms 2528 KB Execution killed with signal 6
30 Runtime error 27 ms 2580 KB Execution killed with signal 6
31 Runtime error 25 ms 2776 KB Execution killed with signal 6
32 Runtime error 25 ms 2740 KB Execution killed with signal 6
33 Runtime error 23 ms 2860 KB Execution killed with signal 6
34 Runtime error 26 ms 2664 KB Execution killed with signal 6
35 Runtime error 24 ms 2860 KB Execution killed with signal 6
36 Runtime error 25 ms 2632 KB Execution killed with signal 6
37 Runtime error 28 ms 2968 KB Execution killed with signal 6
38 Runtime error 24 ms 2736 KB Execution killed with signal 6
39 Runtime error 23 ms 2600 KB Execution killed with signal 6
40 Runtime error 27 ms 2732 KB Execution killed with signal 6