답안 #935540

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
935540 2024-02-29T08:59:16 Z steveonalex Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
27 ms 4672 KB
#include <bits/stdc++.h>
#include "Anna.h"

using namespace std;

namespace Nigga{
typedef long long ll;
typedef unsigned long long ull;

#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()

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);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ll mask){return __builtin_ctzll(mask);}
int logOf(ll mask){return __lg(mask);}

mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}

template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b) {a = b; return true;}
        return false;
    }

template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b) {a = b; return true;}
        return false;
    }

template <class T>
    void printArr(T& container, string separator = " ", string finish = "\n"){
        for(auto item: container) cout << item << separator;
        cout << finish;
    }


template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }
}


void Anna(int N, vector<char> S){
    while(S.size() % 5) S.push_back('X');
    for(int i = 0; i<S.size(); i+= 5){
        int current_number = 0;
        for(int j = i + 4; j>= i; --j){
            current_number = current_number * 3 + (S[j] - 'X');
        }
        for(int j = 0; j<8; ++j){
            Send(current_number % 2);
            current_number /= 2;
        }
    }
}

// int main(void){
//     return 0;
// }
#include <bits/stdc++.h>
#include "Bruno.h"

using namespace std;

namespace Ligma{
typedef long long ll;
typedef unsigned long long ull;

#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()

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);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ll mask){return __builtin_ctzll(mask);}
int logOf(ll mask){return __lg(mask);}

mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}

template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b) {a = b; return true;}
        return false;
    }

template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b) {a = b; return true;}
        return false;
    }

template <class T>
    void printArr(T& container, string separator = " ", string finish = "\n"){
        for(auto item: container) cout << item << separator;
        cout << finish;
    }


template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }
}

void Bruno(int N, int L, vector<int> A){
    int n;
    vector<int> a;
    n = N;
    for(int i = 0; i<L; i += 8){
        int current_num = 0;
        for(int j = i + 7; j>=i; --j){
            current_num = current_num * 2 + A[j];
        }
        for(int j = 0; j < 5; ++j) {
            a.push_back(current_num % 3);
            current_num /= 3;
        }
    }
    while(a.size() > N) a.pop_back();

    int idx=  -1;
    for(int i = 0; i<n; ++i){
        if (a[i] == 0) break;
        Remove(i);
        idx = i;
        break;
    }
    if (idx == -1) return;
    int l = idx + 1;
    for(int i = idx + 1; i<n; ++i) if (a[i] == 2){
        for(; l <= i; ++l) Remove(l);
    }
    for(;l<n; ++l) Remove(l);
    Remove(idx);
}


// int main(void){
//     Bruno(6, 16, {0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0});

//     return 0;
// }

Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:54:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |     for(int i = 0; i<S.size(); i+= 5){
      |                    ~^~~~~~~~~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:65:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   65 |     while(a.size() > N) a.pop_back();
      |           ~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 796 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 4672 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -