제출 #974175

#제출 시각아이디문제언어결과실행 시간메모리
974175steveonalexBroken Device (JOI17_broken_device)C++17
8 / 100
29 ms3152 KiB
#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;
// }

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...