QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#466634#3098. Ancient MachineBalintRCompile Error//C++204.1kb2024-07-07 23:29:052024-07-07 23:29:05

Judging History

你现在查看的是最新测评结果

  • [2024-07-07 23:29:05]
  • 评测
  • [2024-07-07 23:29:05]
  • 提交

Anna

#include <bits/stdc++.h>
#include "Anna.h"
using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef complex<double> cpx;
template <typename T> using minPq = priority_queue<T, vector<T>, greater<T>>;
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) begin(v), end(v)
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound(ALL(v), x) - (v).begin())
#define ubv(v, x) (upper_bound(ALL(v), x) - (v).begin())
template <typename T> inline void UNIQUE(vector<T> &v){sort(ALL(v)); v.resize(unique(ALL(v)) - v.begin());}
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cerr << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cerr << #arr; FR(_i, n) cerr << ' ' << (arr)[_i]; cerr << endl;}
template <typename T, typename U>
ostream& operator<<(ostream &os, pair<T, U> p){return os << "(" << p.fs << ", " << p.sn << ")";}

namespace { // clown
    const int B = 28;
    const int K = 40;
    ll fib[K];

    void init(){
        fib[0] = 1;
        fib[1] = 2;
        FOR(i, 2, K) fib[i] = fib[i-1] + fib[i-2];
    }
}

void Anna(int n, vector<char> str){
    init();
    str.pb('X');

    vi vec;
    bool foundX = false;
    FR(i, n-1){
        if(!foundX){
            if(str[i] == 'X') vec.pb(1), vec.pb(0), foundX = true;
            else vec.pb(0);
        }
        else {
            vec.pb(str[i] == 'Z' && str[i+1] != 'Z');
        }
    }

    while(SZ(vec) % K) vec.pb(0);

    for(int i = 0; i < SZ(vec); i += K){
        int x = 0;
        FR(j, K) x += vec[i+j]*fib[j];
        assert(x < (1<<B));
        FR(j, B) Send((x >> j) & 1);
    }
}

Bruno

#include <bits/stdc++.h>
#include "Bruno.h"
using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef complex<double> cpx;
template <typename T> using minPq = priority_queue<T, vector<T>, greater<T>>;
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) begin(v), end(v)
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound(ALL(v), x) - (v).begin())
#define ubv(v, x) (upper_bound(ALL(v), x) - (v).begin())
template <typename T> inline void UNIQUE(vector<T> &v){sort(ALL(v)); v.resize(unique(ALL(v)) - v.begin());}
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cerr << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cerr << #arr; FR(_i, n) cerr << ' ' << (arr)[_i]; cerr << endl;}
template <typename T, typename U>
ostream& operator<<(ostream &os, pair<T, U> p){return os << "(" << p.fs << ", " << p.sn << ")";}

namespace { // clown
    const int B = 28;
    const int K = 40;
    ll fib[K];

    void init(){
        fib[0] = 1;
        fib[1] = 2;
        FOR(i, 2, K) fib[i] = fib[i-1] + fib[i-2];
    }
}

void Bruno(int n, int l, vector<int> vec){
    vi arr(l/B*K);
    init();
    for(int a = 0, b = 0; b < SZ(vec); b += B, a += K){
        int x = 0;
        FR(j, B) x += vec[b+j] << j;
        FORR(j, K-1, 0) if(x >= fib[j]) x -= fib[j], arr[a+j] = 1;
    }
    vi arr = vec;
    arr.pb(1);

    vi ps;
    FR(i, SZ(arr)) if(arr[i]) ps.pb(i);

    if(SZ(ps) == 1){
        FR(i, n) Remove(i);
        return;
    }

    FOR(i, 1, SZ(ps)) ps[i]--;

    vector<bool> rem(n);
    FOR(i, 1, SZ(ps)){
        FORR(j, ps[i]-1, ps[i-1]+1) Remove(j), rem[j] = true;
        Remove(ps[i]), rem[ps[i]] = true;
    }
    FR(i, n) if(!rem[i]) Remove(i), rem[i] = true;
}

Details

Bruno.code: In function ‘void Bruno(int, int, std::vector<int>)’:
Bruno.code:54:8: error: redeclaration of ‘vi arr’
   54 |     vi arr = vec;
      |        ^~~
Bruno.code:47:8: note: ‘vi arr’ previously declared here
   47 |     vi arr(l/B*K);
      |        ^~~