Submission #1077334

# Submission time Handle Problem Language Result Execution time Memory
1077334 2024-08-27T05:30:46 Z AMO5 Broken Device (JOI17_broken_device) C++17
0 / 100
2 ms 948 KB
#include "Annalib.h"
#include "bits/stdc++.h"
using namespace std;

void Anna( int N, long long X, int K, int P[] ){
    std::vector<int>bad(N, 0);
    for(int i=0; i<K; i++)bad[P[i]]=1;

    auto setBlock=[&](int index, int a, int b, int c)->void{
        Set(index, a);
        Set(index+1, b);
        Set(index+2, c);
    };

    long long tmp = X;
    for(int i=0; i<N; i+=3){
        int cnt = bad[i] + bad[i+1] + bad[i+2];
        if(tmp == 0 || cnt >= 2){
            setBlock(i, 0, 0, 0);
        }else if(cnt == 0){
            int bit = tmp % 4;
            tmp /= 4;
            if(bit == 2){
                setBlock(i, 0, 1, 1);
            }else{
                setBlock(i, 1, tmp/2, tmp%2);
            }
        }else{
            int bit = tmp % 2;
            tmp /= 2;
            if(bad[i]){
                if(bit == 0) setBlock(i, 0, 1, 0);
                else setBlock(i, 0, 0, 1);
            }else if(bad[i+1]){
                if(bit == 0){
                    int bit2 = tmp % 2;
                    tmp /= 2;
                    if(bit2 == 0) setBlock(i, 1, 0, 0);
                    else setBlock(i, 1, 0, 1);
                }
                else setBlock(i, 0, 0, 1);
            }else{
                if(bit == 0) setBlock(i, 0, 1, 0);
                else setBlock(i, 1, 1, 0);
            }
        }
    }
}
#include "Brunolib.h"
#include "bits/stdc++.h"
using namespace std;

long long Bruno( int N, int A[] ){
    std::vector<int>bits;
    for(int i=0; i<N; i+=3){
        int val = 4 * A[i] + 2 * A[i+1] + A[i+2];
        if(val == 0)continue;
        if(val == 1) bits.emplace_back(1);
        else if(val == 2) bits.emplace_back(0);
        else if(val == 3) bits.emplace_back(1), bits.emplace_back(0);
        else if(val == 4) bits.emplace_back(0), bits.emplace_back(0);
        else if(val == 5) bits.emplace_back(0), bits.emplace_back(1);
        else if(val == 6) bits.emplace_back(1);
        else bits.emplace_back(1), bits.emplace_back(1);
    }
    long long answer = 0LL;
    while(!bits.empty()){
        answer *= 2LL;
        answer += bits.back();
        bits.pop_back();
    }
    return answer;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 780 KB Wrong Answer [3]
2 Incorrect 0 ms 796 KB Wrong Answer [3]
3 Incorrect 0 ms 796 KB Wrong Answer [3]
4 Incorrect 0 ms 784 KB Wrong Answer [3]
5 Incorrect 1 ms 796 KB Wrong Answer [3]
6 Incorrect 0 ms 796 KB Wrong Answer [3]
7 Incorrect 1 ms 796 KB Wrong Answer [3]
8 Incorrect 1 ms 784 KB Wrong Answer [3]
9 Incorrect 0 ms 796 KB Wrong Answer [3]
10 Incorrect 0 ms 796 KB Wrong Answer [3]
11 Incorrect 0 ms 792 KB Wrong Answer [3]
12 Incorrect 1 ms 784 KB Wrong Answer [3]
13 Incorrect 1 ms 796 KB Wrong Answer [3]
14 Incorrect 0 ms 796 KB Wrong Answer [3]
15 Incorrect 0 ms 796 KB Wrong Answer [3]
16 Incorrect 1 ms 792 KB Wrong Answer [3]
17 Incorrect 1 ms 796 KB Wrong Answer [3]
18 Incorrect 0 ms 784 KB Wrong Answer [3]
19 Incorrect 0 ms 796 KB Wrong Answer [3]
20 Incorrect 1 ms 784 KB Wrong Answer [3]
21 Incorrect 0 ms 796 KB Wrong Answer [3]
22 Incorrect 1 ms 784 KB Wrong Answer [3]
23 Incorrect 1 ms 796 KB Wrong Answer [3]
24 Incorrect 1 ms 796 KB Wrong Answer [3]
25 Incorrect 0 ms 784 KB Wrong Answer [3]
26 Incorrect 0 ms 796 KB Wrong Answer [3]
27 Incorrect 1 ms 948 KB Wrong Answer [3]
28 Incorrect 1 ms 796 KB Wrong Answer [3]
29 Incorrect 0 ms 800 KB Wrong Answer [3]
30 Incorrect 0 ms 780 KB Wrong Answer [3]
31 Incorrect 0 ms 784 KB Wrong Answer [3]
32 Incorrect 1 ms 796 KB Wrong Answer [3]
33 Incorrect 2 ms 796 KB Wrong Answer [3]
34 Incorrect 0 ms 784 KB Wrong Answer [3]
35 Incorrect 1 ms 784 KB Wrong Answer [3]
36 Incorrect 1 ms 784 KB Wrong Answer [3]
37 Incorrect 0 ms 784 KB Wrong Answer [3]
38 Incorrect 0 ms 780 KB Wrong Answer [3]
39 Incorrect 1 ms 796 KB Wrong Answer [3]
40 Incorrect 1 ms 780 KB Wrong Answer [3]