Submission #471482

# Submission time Handle Problem Language Result Execution time Memory
471482 2021-09-09T13:26:53 Z Rainbowbunny Broken Device (JOI17_broken_device) C++17
51 / 100
52 ms 2760 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

int num[] = {0, 0, 1, 0, 0, 1, 2, 3};
int sd[] = {0, 1, 1, 0, 2, 2, 2, 2};

void Anna(int n, long long X, int k, int P[])
{
    vector <int> A;
    vector <int> G;
    for(int i = 0; i < n; i++)
    {
        A.push_back(X & 1);
        X >>= 1;
        G.push_back(0);
    }
    for(int i = 0; i < k; i++)
    {
        G[P[i]] = 1; 
    }
    int pos = 0;
    for(int i = 0; i < n; i += 3)
    {
        int tmp = G[i] + 2 * G[i + 1] + 4 * G[i + 2];
        int t = 0;
        for(int j = 0; j < 8; j++)
        {
            if((tmp & j) == 0)
            {
                int zz = num[j], nn = 1;
                for(int k = 0; k < sd[j]; k++)
                {
                    zz -= nn * A[pos + k];
                    nn *= 2;
                }
                if(zz == 0)
                {
                    t = j;
                }
            }
        }
        for(int j = 0; j < 3; j++)
        {
            Set(i + j, (t >> j) & 1);
        }
        pos += sd[t];
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

int num[] = {0, 0, 1, 0, 0, 1, 2, 3};
int sd[] = {0, 1, 1, 0, 2, 2, 2, 2};

long long Bruno(int n, int A[])
{
    vector <int> V;
    for(int i = 0; i < n; i += 3)
    {
        int tmp = A[i] + A[i + 1] * 2 + A[i + 2] * 4;
        for(int j = 0; j < sd[tmp]; j++)
        {
            V.push_back((num[tmp] >> j) & 1);
        }    
    }
    long long ans = 0, bit = 1;
    for(int i = 0; i < 60; i++)
    {
        ans += bit * V[i];
        bit *= 2;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 45 ms 2456 KB Output is partially correct - L* = 20
2 Partially correct 41 ms 2516 KB Output is partially correct - L* = 20
3 Partially correct 44 ms 2468 KB Output is partially correct - L* = 21
4 Partially correct 41 ms 2520 KB Output is partially correct - L* = 23
5 Partially correct 40 ms 2492 KB Output is partially correct - L* = 20
6 Partially correct 41 ms 2460 KB Output is partially correct - L* = 22
7 Partially correct 41 ms 2616 KB Output is partially correct - L* = 20
8 Partially correct 41 ms 2472 KB Output is partially correct - L* = 20
9 Partially correct 41 ms 2588 KB Output is partially correct - L* = 20
10 Partially correct 41 ms 2476 KB Output is partially correct - L* = 20
11 Partially correct 46 ms 2472 KB Output is partially correct - L* = 21
12 Partially correct 52 ms 2760 KB Output is partially correct - L* = 20
13 Partially correct 49 ms 2504 KB Output is partially correct - L* = 21
14 Partially correct 41 ms 2472 KB Output is partially correct - L* = 22
15 Partially correct 52 ms 2628 KB Output is partially correct - L* = 20
16 Partially correct 50 ms 2556 KB Output is partially correct - L* = 22
17 Partially correct 41 ms 2468 KB Output is partially correct - L* = 21
18 Partially correct 49 ms 2472 KB Output is partially correct - L* = 20
19 Partially correct 40 ms 2528 KB Output is partially correct - L* = 22
20 Partially correct 43 ms 2636 KB Output is partially correct - L* = 20
21 Partially correct 41 ms 2416 KB Output is partially correct - L* = 21
22 Partially correct 40 ms 2528 KB Output is partially correct - L* = 20
23 Partially correct 43 ms 2508 KB Output is partially correct - L* = 20
24 Partially correct 40 ms 2600 KB Output is partially correct - L* = 21
25 Partially correct 41 ms 2564 KB Output is partially correct - L* = 20
26 Partially correct 49 ms 2396 KB Output is partially correct - L* = 20
27 Partially correct 40 ms 2476 KB Output is partially correct - L* = 22
28 Partially correct 47 ms 2484 KB Output is partially correct - L* = 21
29 Partially correct 41 ms 2480 KB Output is partially correct - L* = 21
30 Partially correct 40 ms 2468 KB Output is partially correct - L* = 21
31 Partially correct 41 ms 2468 KB Output is partially correct - L* = 22
32 Partially correct 40 ms 2476 KB Output is partially correct - L* = 20
33 Partially correct 46 ms 2472 KB Output is partially correct - L* = 20
34 Partially correct 50 ms 2572 KB Output is partially correct - L* = 22
35 Partially correct 41 ms 2576 KB Output is partially correct - L* = 20
36 Partially correct 40 ms 2500 KB Output is partially correct - L* = 21
37 Partially correct 46 ms 2644 KB Output is partially correct - L* = 20
38 Partially correct 41 ms 2424 KB Output is partially correct - L* = 22
39 Partially correct 41 ms 2548 KB Output is partially correct - L* = 20
40 Partially correct 40 ms 2448 KB Output is partially correct - L* = 21