Submission #92442

# Submission time Handle Problem Language Result Execution time Memory
92442 2019-01-02T21:27:51 Z Alexa2001 Broken Device (JOI17_broken_device) C++17
0 / 100
48 ms 3056 KB
#include "Annalib.h"

bool broken[200];

void setBlock(int i, int val)
{
    Set(i+2, val&1); val >>= 1;
    Set(i+1, val&1); val >>= 1;
    Set(i, val&1);
}

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

    for(i=0; i<N; i+=3)
    {
        int x, y, z;
        x = broken[i], y = broken[i+1], z = broken[i+2];

        if(x+y+z >= 2) /// skip
        {
            setBlock(i, 0);
            continue;
        }

        if(x+y+z == 0)
        {
            if((X & 3) == 0) setBlock(i, 7);
                else if((X & 3) == 1) setBlock(i, 5);
                    else if((X & 3) == 2) setBlock(i, 2);
                        else setBlock(i, 3);
            X >>= 2;
        }
        else
        {
            if(!(X&1) && !z) setBlock(i, 1);
                else if((X&1) && !x) setBlock(i, 4);
                    else if(!(X&1) && z) setBlock(i, 6);
                        else
                        {
                            if(X&2) setBlock(i, 2);
                                else setBlock(i, 3);
                            X >>= 1;
                        }
            X >>= 1;
        }
    }
}
#include "Brunolib.h"

long long Bruno( int N, int A[] )
{
    int i, bit = 0;
    long long ans = 0;

    for(i=0; i<N; i+=3)
    {
        int val = (A[i]<<2) + (A[i+1]<<1) + A[i+2];
        if(!val) continue;

        if(val == 1 || val == 6)
        {
            ++bit;
            continue;
        }
        if(val == 4)
        {
            ans += (1LL<<bit);
            ++bit;
            continue;
        }
        if(val == 5) ans += (1LL<<bit);
            else if(val == 2) ans += (2LL<<bit);
                else if(val == 3) ans += (3LL<<bit);
        bit += 2;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 2800 KB Output isn't correct - L* = 0
2 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
3 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
4 Incorrect 33 ms 2800 KB Output isn't correct - L* = 0
5 Incorrect 33 ms 2808 KB Output isn't correct - L* = 0
6 Incorrect 34 ms 2912 KB Output isn't correct - L* = 0
7 Incorrect 34 ms 2800 KB Output isn't correct - L* = 0
8 Incorrect 33 ms 2800 KB Output isn't correct - L* = 0
9 Incorrect 33 ms 3008 KB Output isn't correct - L* = 0
10 Incorrect 44 ms 2808 KB Output isn't correct - L* = 0
11 Incorrect 34 ms 2800 KB Output isn't correct - L* = 0
12 Incorrect 34 ms 2800 KB Output isn't correct - L* = 0
13 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
14 Incorrect 32 ms 2800 KB Output isn't correct - L* = 0
15 Incorrect 33 ms 2800 KB Output isn't correct - L* = 0
16 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
17 Incorrect 34 ms 2800 KB Output isn't correct - L* = 0
18 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
19 Incorrect 34 ms 2800 KB Output isn't correct - L* = 0
20 Incorrect 33 ms 3056 KB Output isn't correct - L* = 0
21 Incorrect 34 ms 2808 KB Output isn't correct - L* = 0
22 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
23 Incorrect 34 ms 3016 KB Output isn't correct - L* = 0
24 Incorrect 34 ms 2800 KB Output isn't correct - L* = 0
25 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
26 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
27 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
28 Incorrect 33 ms 2800 KB Output isn't correct - L* = 0
29 Incorrect 33 ms 2800 KB Output isn't correct - L* = 0
30 Incorrect 34 ms 2800 KB Output isn't correct - L* = 0
31 Incorrect 33 ms 3056 KB Output isn't correct - L* = 0
32 Incorrect 33 ms 2800 KB Output isn't correct - L* = 0
33 Incorrect 33 ms 2800 KB Output isn't correct - L* = 0
34 Incorrect 48 ms 2800 KB Output isn't correct - L* = 0
35 Incorrect 32 ms 2800 KB Output isn't correct - L* = 0
36 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
37 Incorrect 34 ms 2800 KB Output isn't correct - L* = 0
38 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0
39 Incorrect 33 ms 2800 KB Output isn't correct - L* = 0
40 Incorrect 34 ms 3056 KB Output isn't correct - L* = 0