Submission #1011664

# Submission time Handle Problem Language Result Execution time Memory
1011664 2024-07-01T03:51:03 Z 12345678 Broken Device (JOI17_broken_device) C++17
85 / 100
27 ms 3048 KB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=150;
mt19937 rng(12345678);
int f, c[nx];
vector<pair<int, int>> v;

void init()
{
    for (int i=0; i<nx; i++) v.push_back({rng(), i});
    sort(v.begin(), v.end());
    for (int i=0; i<nx; i++) c[i]=v[i].second;
}

void Anna( int N, long long X, int K, int P[] ){
    if (!f) f=1, init();
    vector<int> b(nx);
    //for (int i=0; i<N;i ++) cout<<"perm "<<i<<' '<<c[i]<<'\n';
    for (int i=0; i<K; i++) b[P[i]]=1;
    for (int i=0; i<75; i++)
    {
        if (b[c[2*i]]||b[c[2*i+1]]||X==0) Set(c[2*i], 0), Set(c[2*i+1], 0);
        else Set(c[2*i], ((X%3)+1)/2), Set(c[2*i+1], ((X%3)+1)%2), X/=3;
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int kx=60, nxx=150;

mt19937 rng2(12345678);
int f2, c2[nxx];
vector<pair<int, int>> v2;

void init2()
{
    for (int i=0; i<nxx; i++) v2.push_back({rng2(), i});
    sort(v2.begin(), v2.end());
    for (int i=0; i<nxx; i++) c2[i]=v2[i].second;
}

long long Bruno( int N, int A[] ){
    if (!f2) f2=1, init2(); 
    vector<ll> p(kx);
    ll res=0, cnt=0;
    p[0]=1;
    for (int i=1; i<kx; i++) p[i]=p[i-1]*3;
    for (int i=0; i<75; i++) if (A[c2[2*i]]||A[c2[2*i+1]]) res+=p[cnt]*(A[c2[2*i]]*2+A[c2[2*i+1]]-1),cnt++; 
    return res;
}
# Verdict Execution time Memory Grader output
1 Partially correct 23 ms 3048 KB Output is partially correct - L* = 38
2 Partially correct 20 ms 3020 KB Output is partially correct - L* = 39
3 Correct 20 ms 2864 KB Output is correct - L* = 40
4 Partially correct 20 ms 2772 KB Output is partially correct - L* = 37
5 Partially correct 20 ms 2776 KB Output is partially correct - L* = 38
6 Partially correct 20 ms 2880 KB Output is partially correct - L* = 39
7 Partially correct 25 ms 2764 KB Output is partially correct - L* = 37
8 Partially correct 20 ms 2752 KB Output is partially correct - L* = 38
9 Partially correct 25 ms 2876 KB Output is partially correct - L* = 39
10 Partially correct 20 ms 2776 KB Output is partially correct - L* = 39
11 Partially correct 20 ms 2808 KB Output is partially correct - L* = 38
12 Partially correct 20 ms 2784 KB Output is partially correct - L* = 39
13 Correct 20 ms 2852 KB Output is correct - L* = 40
14 Partially correct 20 ms 2868 KB Output is partially correct - L* = 39
15 Partially correct 20 ms 2776 KB Output is partially correct - L* = 39
16 Partially correct 27 ms 2772 KB Output is partially correct - L* = 39
17 Partially correct 20 ms 2772 KB Output is partially correct - L* = 39
18 Partially correct 20 ms 2776 KB Output is partially correct - L* = 39
19 Partially correct 25 ms 2772 KB Output is partially correct - L* = 39
20 Partially correct 23 ms 2772 KB Output is partially correct - L* = 39
21 Partially correct 20 ms 2764 KB Output is partially correct - L* = 39
22 Partially correct 24 ms 2688 KB Output is partially correct - L* = 39
23 Partially correct 20 ms 2772 KB Output is partially correct - L* = 39
24 Partially correct 23 ms 2776 KB Output is partially correct - L* = 39
25 Partially correct 20 ms 2780 KB Output is partially correct - L* = 39
26 Partially correct 20 ms 2776 KB Output is partially correct - L* = 39
27 Partially correct 20 ms 2784 KB Output is partially correct - L* = 39
28 Partially correct 20 ms 2768 KB Output is partially correct - L* = 38
29 Partially correct 20 ms 2772 KB Output is partially correct - L* = 38
30 Partially correct 20 ms 2840 KB Output is partially correct - L* = 38
31 Partially correct 20 ms 2680 KB Output is partially correct - L* = 38
32 Partially correct 20 ms 2784 KB Output is partially correct - L* = 39
33 Partially correct 24 ms 2768 KB Output is partially correct - L* = 38
34 Partially correct 20 ms 2776 KB Output is partially correct - L* = 39
35 Partially correct 20 ms 2864 KB Output is partially correct - L* = 39
36 Correct 20 ms 2764 KB Output is correct - L* = 40
37 Partially correct 20 ms 2820 KB Output is partially correct - L* = 39
38 Partially correct 20 ms 2868 KB Output is partially correct - L* = 38
39 Partially correct 26 ms 2772 KB Output is partially correct - L* = 39
40 Partially correct 20 ms 2776 KB Output is partially correct - L* = 38