QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#466609#3098. Ancient MachineBalintR5 34ms9828kbC++204.0kb2024-07-07 23:10:272024-07-07 23:10:27

Judging History

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

  • [2024-07-07 23:10:27]
  • 评测
  • 测评结果:5
  • 用时:34ms
  • 内存:9828kb
  • [2024-07-07 23:10:27]
  • 提交

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;
    int firstX = -1;
    FR(i, n){
        if(firstX == -1){
            if(str[i] == 'X') vec.pb(1), firstX = i;
            else vec.pb(0);
        }
        else {
            vec.pb(str[i] == 'Z' && str[i+1] != 'Z' && i-1 != firstX);
        }
    }
    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;
    }

    vector<bool> rem(n);
    vi ps;
    FR(i, l) if(arr[i]) ps.pb(i);
    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;
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 100
Accepted
time: 0ms
memory: 3704kb

input:

18
Y X Y Z X Z X X Z Z Y Y Z Y Y Z X X

output:

28
1100010000010000000000000000

input:

28
1100010000010000000000000000

output:

0 28 3

result:

ok n = 18, D = 28, L = 3

Test #2:

score: 100
Accepted
time: 0ms
memory: 3744kb

input:

18
X Z X Y Y Y X Z X Y Z Z Z Z Y Z Z Y

output:

28
1011100100110000000000000000

input:

28
1011100100110000000000000000

output:

0 28 3

result:

ok n = 18, D = 28, L = 3

Test #3:

score: 100
Accepted
time: 0ms
memory: 3816kb

input:

18
Y Z Z Y Z X X Z Y Y Z Z Z Y X X Z Y

output:

28
0000001111010000000000000000

input:

28
0000001111010000000000000000

output:

0 28 2

result:

ok n = 18, D = 28, L = 2

Test #4:

score: 100
Accepted
time: 0ms
memory: 3820kb

input:

18
X Z Z X Z X X Z X Y Y X X Z X Y Z X

output:

28
0001010100110000000000000000

input:

28
0001010100110000000000000000

output:

0 28 2

result:

ok n = 18, D = 28, L = 2

Test #5:

score: 100
Accepted
time: 0ms
memory: 3812kb

input:

18
X Y X Y Y X X Z Y Z Y X Z Y Y X X Z

output:

28
0101001001001000000000000000

input:

28
0101001001001000000000000000

output:

0 28 5

result:

ok n = 18, D = 28, L = 5

Test #6:

score: 100
Accepted
time: 0ms
memory: 4124kb

input:

18
X X Y Z X Y Y Y X X Z X X X Z X Z Z

output:

28
0110001100101000000000000000

input:

28
0110001100101000000000000000

output:

0 28 2

result:

ok n = 18, D = 28, L = 2

Test #7:

score: 100
Accepted
time: 0ms
memory: 3820kb

input:

3
X Y Z

output:

28
0010000000000000000000000000

input:

28
0010000000000000000000000000

output:

0 28 1

result:

ok n = 3, D = 28, L = 1

Test #8:

score: 100
Accepted
time: 0ms
memory: 3812kb

input:

3
Z Y X

output:

28
1100000000000000000000000000

input:

28
1100000000000000000000000000

output:

0 28 0

result:

ok n = 3, D = 28, L = 0

Test #9:

score: 100
Accepted
time: 0ms
memory: 4120kb

input:

18
X X X X X X X X X X X X X X X X X X

output:

28
1000000000000000000000000000

input:

28
1000000000000000000000000000

output:

0 28 0

result:

ok n = 18, D = 28, L = 0

Test #10:

score: 100
Accepted
time: 0ms
memory: 4056kb

input:

18
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y

output:

28
0000000000000000000000000000

input:

28
0000000000000000000000000000

output:

0 28 0

result:

ok n = 18, D = 28, L = 0

Test #11:

score: 100
Accepted
time: 0ms
memory: 3852kb

input:

18
Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z

output:

28
0000000000000000000000000000

input:

28
0000000000000000000000000000

output:

0 28 0

result:

ok n = 18, D = 28, L = 0

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 34ms
memory: 9828kb

input:

100000
X Z X Z Z X Y Z Y X Y X Z Z Z Y X Z Y X Y Y X Y Y Y Z Y Z Z Y X X Y X X Y Y X X X Z Y Y Y Z Z Z Z Y X Y Y Z Z Z X Y Z X X X X Y X Y X X Z X Z Z Z X Y X X X Z X Z X X X Y Y Y Y Z X X Y Z Y Y X Z X Z Z Z Z Z Y Z Y X Y Y Y Y X Z Z Y Z Z Y Z Z Z X Z Z X X Z Z Z Z X X Z Y Y Z Y Y Z Z Y Y Z Y Z Y Z...

output:

70000
110101010001111010011000000010111101011010101011111001100011000000011011110001110100001010011110001101101001000100010100111100010110010011100010000111110001101100000110110100111011010000010011101010000101001110110001010001000000010001101010101011101010111111010011101010011101000010011101111110...

input:

70000
110101010001111010011000000010111101011010101011111001100011000000011011110001110100001010011110001101101001000100010100111100010110010011100010000111110001101100000110110100111011010000010011101010000101001110110001010001000000010001101010101011101010111111010011101010011101000010011101111110...

output:

0 70000 15487

result:

wrong answer your query is valid but your solution is not optimal: read 15487 but expected 22133