Submission #974175

# Submission time Handle Problem Language Result Execution time Memory
974175 2024-05-03T04:18:49 Z steveonalex Broken Device (JOI17_broken_device) C++17
8 / 100
29 ms 3152 KB
#include <bits/stdc++.h>
#include "Annalib.h"
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define ALL(v) (v).begin(), (v).end()
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
 
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng(1);
ll rngesus(ll l, ll r){return ((ull) rng()) % (r - l + 1) + l;}
 
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
 
ll LASTBIT(ll mask){return mask & (-mask);}
ll pop_cnt(ll mask){return __builtin_popcountll(mask);}
ll ctz(ll mask){return __builtin_ctzll(mask);}
ll clz(ll mask){return __builtin_clzll(mask);}
ll logOf(ll mask){return 63 - clz(mask);}
 
template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b){a = b; return true;}
        return false;
    }
template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b){a = b; return true;}
        return false;
    }
template <class T>
    void printArr(T& a, string separator = " ", string finish = "\n", ostream& out = cout){
        for(auto i: a) out << i << separator;
        out << finish;
    }
template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }

void Anna(int n, ll X, int k, int p[]){
    string s = "";
    for(int i = 0; i< 60; ++i) s.push_back('0' + GETBIT(X, i));

    string sigma;
    for(int j = 0; j < 7; ++j){
        int cnt = 0;
        for(int i = 0; i< 60; ++i) if (!GETBIT(i, j) && s[i] == '1') cnt ^= 1;
        sigma.push_back('0' + cnt);
    }

    s = s + s + sigma;

    while(s.size() < n) s.push_back('0');

    for(int i = 0; i<n; ++i) Set(i, (s[i] == '1'));
}
 
// int main(void){
//     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//     int p[] = {0};
//     Anna(150, 69420, 1, p);

//     return 0;
// }
#include <bits/stdc++.h>
#include "Brunolib.h"
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define ALL(v) (v).begin(), (v).end()
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
 
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng(1);
ll rngesus(ll l, ll r){return ((ull) rng()) % (r - l + 1) + l;}
 
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
 
ll LASTBIT(ll mask){return mask & (-mask);}
ll pop_cnt(ll mask){return __builtin_popcountll(mask);}
ll ctz(ll mask){return __builtin_ctzll(mask);}
ll clz(ll mask){return __builtin_clzll(mask);}
ll logOf(ll mask){return 63 - clz(mask);}
 
template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b){a = b; return true;}
        return false;
    }
template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b){a = b; return true;}
        return false;
    }
template <class T>
    void printArr(T& a, string separator = " ", string finish = "\n", ostream& out = cout){
        for(auto i: a) out << i << separator;
        out << finish;
    }
template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }

ll Bruno(int n, int A[]){
    vector<bool> sigma;
    for(int j = 0; j < 7; ++j){
        int cnt = 0;
        for(int i = 0; i<60; ++i) if (!GETBIT(i, j) && A[i]) cnt ^= 1;
        sigma.push_back(cnt);
    }

    ll X = 0;
    for(int i = 0; i<60; ++i){
        if (A[i] == A[i+60]) {
            if (A[i]) X += MASK(i);
        }
        else{
            bool check = true;
            for(int j = 0; j< 7; ++j) if (sigma[j] != A[120 + j]) {
                check = false;
            }
            int u = i;
            if (!check) u += 60;
            if (A[u]) X += MASK(i);
        }
    }
    return X;
}
 
// int main(void){
//     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);



//     return 0;
// }

Compilation message

Anna.cpp: In function 'void Anna(int, ll, int, int*)':
Anna.cpp:60:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   60 |     while(s.size() < n) s.push_back('0');
      |           ~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Partially correct 27 ms 2776 KB Output is partially correct - L* = 14
2 Partially correct 27 ms 2776 KB Output is partially correct - L* = 14
3 Partially correct 25 ms 2752 KB Output is partially correct - L* = 14
4 Partially correct 27 ms 2780 KB Output is partially correct - L* = 14
5 Partially correct 27 ms 2752 KB Output is partially correct - L* = 14
6 Partially correct 27 ms 2772 KB Output is partially correct - L* = 14
7 Partially correct 25 ms 2776 KB Output is partially correct - L* = 14
8 Partially correct 26 ms 2784 KB Output is partially correct - L* = 14
9 Partially correct 27 ms 2860 KB Output is partially correct - L* = 14
10 Partially correct 26 ms 2784 KB Output is partially correct - L* = 14
11 Partially correct 25 ms 2820 KB Output is partially correct - L* = 14
12 Partially correct 29 ms 3152 KB Output is partially correct - L* = 14
13 Partially correct 26 ms 2860 KB Output is partially correct - L* = 14
14 Partially correct 27 ms 2772 KB Output is partially correct - L* = 14
15 Partially correct 27 ms 2672 KB Output is partially correct - L* = 14
16 Partially correct 26 ms 2784 KB Output is partially correct - L* = 14
17 Partially correct 26 ms 2752 KB Output is partially correct - L* = 14
18 Partially correct 26 ms 2864 KB Output is partially correct - L* = 14
19 Partially correct 25 ms 2784 KB Output is partially correct - L* = 14
20 Partially correct 26 ms 2784 KB Output is partially correct - L* = 14
21 Partially correct 26 ms 2756 KB Output is partially correct - L* = 14
22 Partially correct 26 ms 2780 KB Output is partially correct - L* = 14
23 Partially correct 25 ms 2752 KB Output is partially correct - L* = 14
24 Partially correct 27 ms 2984 KB Output is partially correct - L* = 14
25 Partially correct 26 ms 2776 KB Output is partially correct - L* = 14
26 Partially correct 25 ms 2752 KB Output is partially correct - L* = 14
27 Partially correct 26 ms 2756 KB Output is partially correct - L* = 14
28 Partially correct 26 ms 2772 KB Output is partially correct - L* = 15
29 Partially correct 25 ms 2772 KB Output is partially correct - L* = 14
30 Partially correct 26 ms 2692 KB Output is partially correct - L* = 14
31 Partially correct 26 ms 2780 KB Output is partially correct - L* = 14
32 Partially correct 27 ms 2756 KB Output is partially correct - L* = 14
33 Partially correct 26 ms 2768 KB Output is partially correct - L* = 14
34 Partially correct 26 ms 2680 KB Output is partially correct - L* = 14
35 Partially correct 25 ms 2756 KB Output is partially correct - L* = 14
36 Partially correct 26 ms 2748 KB Output is partially correct - L* = 14
37 Partially correct 25 ms 2776 KB Output is partially correct - L* = 14
38 Partially correct 26 ms 2776 KB Output is partially correct - L* = 14
39 Partially correct 27 ms 2772 KB Output is partially correct - L* = 14
40 Partially correct 26 ms 2948 KB Output is partially correct - L* = 14