Submission #471486

# Submission time Handle Problem Language Result Execution time Memory
471486 2021-09-09T13:31:47 Z Rainbowbunny Broken Device (JOI17_broken_device) C++17
51 / 100
52 ms 2552 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 and sd[t] < sd[j])
                {
                    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 41 ms 2400 KB Output is partially correct - L* = 23
2 Partially correct 41 ms 2452 KB Output is partially correct - L* = 23
3 Partially correct 41 ms 2368 KB Output is partially correct - L* = 23
4 Partially correct 41 ms 2412 KB Output is partially correct - L* = 23
5 Partially correct 41 ms 2368 KB Output is partially correct - L* = 20
6 Partially correct 44 ms 2424 KB Output is partially correct - L* = 25
7 Partially correct 41 ms 2372 KB Output is partially correct - L* = 20
8 Partially correct 47 ms 2384 KB Output is partially correct - L* = 25
9 Partially correct 40 ms 2404 KB Output is partially correct - L* = 22
10 Partially correct 40 ms 2424 KB Output is partially correct - L* = 23
11 Partially correct 41 ms 2348 KB Output is partially correct - L* = 21
12 Partially correct 42 ms 2444 KB Output is partially correct - L* = 22
13 Partially correct 40 ms 2360 KB Output is partially correct - L* = 23
14 Partially correct 41 ms 2344 KB Output is partially correct - L* = 26
15 Partially correct 41 ms 2532 KB Output is partially correct - L* = 34
16 Partially correct 43 ms 2492 KB Output is partially correct - L* = 22
17 Partially correct 47 ms 2396 KB Output is partially correct - L* = 21
18 Partially correct 40 ms 2364 KB Output is partially correct - L* = 24
19 Partially correct 40 ms 2376 KB Output is partially correct - L* = 23
20 Partially correct 40 ms 2436 KB Output is partially correct - L* = 26
21 Partially correct 52 ms 2392 KB Output is partially correct - L* = 30
22 Partially correct 41 ms 2400 KB Output is partially correct - L* = 22
23 Partially correct 49 ms 2344 KB Output is partially correct - L* = 21
24 Partially correct 45 ms 2520 KB Output is partially correct - L* = 25
25 Partially correct 41 ms 2388 KB Output is partially correct - L* = 20
26 Partially correct 41 ms 2408 KB Output is partially correct - L* = 23
27 Partially correct 40 ms 2408 KB Output is partially correct - L* = 23
28 Partially correct 40 ms 2484 KB Output is partially correct - L* = 21
29 Partially correct 41 ms 2540 KB Output is partially correct - L* = 29
30 Partially correct 41 ms 2348 KB Output is partially correct - L* = 21
31 Partially correct 41 ms 2520 KB Output is partially correct - L* = 22
32 Partially correct 41 ms 2376 KB Output is partially correct - L* = 30
33 Partially correct 49 ms 2404 KB Output is partially correct - L* = 20
34 Partially correct 40 ms 2368 KB Output is partially correct - L* = 22
35 Partially correct 40 ms 2400 KB Output is partially correct - L* = 23
36 Partially correct 40 ms 2476 KB Output is partially correct - L* = 23
37 Partially correct 40 ms 2552 KB Output is partially correct - L* = 24
38 Partially correct 41 ms 2424 KB Output is partially correct - L* = 22
39 Partially correct 48 ms 2400 KB Output is partially correct - L* = 20
40 Partially correct 40 ms 2456 KB Output is partially correct - L* = 21