QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#20587 | #3098. Ancient Machine | linmuhan# | 5 | 56ms | 11852kb | C++20 | 1.9kb | 2022-02-16 18:51:21 | 2023-01-17 10:46:00 |
Judging History
Anna
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
const int NT = 120021;
#define ll long long
int bi[NT], tot = 0;
ll Sum = 0, fib[NT];
int sd[NT], cnt = 0;
void Anna (int N, vector <char> S) {
int p = -1;
for (int i=0;i<N;i++) {
if (S[i] == 'X') {
p = i;
break ;
}
}
if (S[p + 1] == 'Z') S[p + 1] = 'X';
bi[p] = 1; bi[p + 1] = 0; tot = p + 2;
for (int l=p+1,r;l<N;l=r+1) {
r = l; if (S[r] != 'Z') continue ;
while (S[r] == S[l] && r < N) r ++; r --;
bi[r] = 1; tot = r + 1;
}
fib[0] = 1; fib[1] = 2;
for (int i=2;i<=64;i++) fib[i] = fib[i - 1] + fib[i - 2];
for (int i=0;i<tot;i+=64) {
Sum = 0;
for (int j=0;j<64;j++) {
int t = j + i; if (t >= tot) break ;
if (bi[j]) Sum += fib[j];
}
for (int t=0;t<44;t++) {
if (Sum & (1ll << t)) sd[++ cnt] = 1;
else sd[++ cnt] = 0;
}
}
for (int i=1;i<=cnt;i++) Send (sd[i]);
}
Bruno
#include "Bruno.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int NTT = 120021;
int bit[NTT];
ll fibb[NTT];
bool rem[NTT];
void Bruno(int N, int L, vector<int> A) {
// for (int i=0;i<A.size();i++) cout << A[i]; puts ("");
fibb[0] = 1; fibb[1] = 2;
for (int i=2;i<=64;i++) fibb[i] = fibb[i - 1] + fibb[i - 2];
int p = 0;
for (int i=0;i<L;i+=44) {
ll sum = 0;
for (int j=i+43;j>=i;j--) sum = sum * 2 + A[j];
for (int j=63;j>=0;j--) {
if (sum >= fibb[j]) {
sum -= fibb[j];
bit[j + p] = 1;
}
}
p += 64;
}
p = min (p, N);
// for (int i=0;i<p;i++) cout << bit[i]; puts ("");
int t = -1;
for (int i=0;i<p;i++) {
if (bit[i]) {
t = i;
break ;
}
Remove (i); rem[i] = 1;
}
if (t == -1) {
return ;
}
rem[t] = 1;
for (int j=t+1;j<p;j++) {
if (bit[j]) {
for (int k=j-1;!rem[k];k--) Remove (k), rem[k] = 1;
Remove (j); rem[j] = 1;
}
}
rem[t] = 1; Remove (t);
for (int i=0;i<p;i++) if (! rem[i]) Remove (i);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 100
Accepted
time: 2ms
memory: 3688kb
input:
18 Y X Y Z X Z X X Z Z Y Y Z Y Y Z X X
output:
44 11000100000100000000000000000000000000000000
input:
44 11000100000100000000000000000000000000000000
output:
0 44 3
result:
ok n = 18, D = 44, L = 3
Test #2:
score: 100
Accepted
time: 4ms
memory: 3712kb
input:
18 X Z X Y Y Y X Z X Y Z Z Z Z Y Z Z Y
output:
44 10111001001100000000000000000000000000000000
input:
44 10111001001100000000000000000000000000000000
output:
0 44 3
result:
ok n = 18, D = 44, L = 3
Test #3:
score: 100
Accepted
time: 4ms
memory: 5688kb
input:
18 Y Z Z Y Z X X Z Y Y Z Z Z Y X X Z Y
output:
44 00000011110100000000000000000000000000000000
input:
44 00000011110100000000000000000000000000000000
output:
0 44 2
result:
ok n = 18, D = 44, L = 2
Test #4:
score: 100
Accepted
time: 4ms
memory: 3792kb
input:
18 X Z Z X Z X X Z X Y Y X X Z X Y Z X
output:
44 00010101001100000000000000000000000000000000
input:
44 00010101001100000000000000000000000000000000
output:
0 44 2
result:
ok n = 18, D = 44, L = 2
Test #5:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
18 X Y X Y Y X X Z Y Z Y X Z Y Y X X Z
output:
44 01010010010010000000000000000000000000000000
input:
44 01010010010010000000000000000000000000000000
output:
0 44 5
result:
ok n = 18, D = 44, L = 5
Test #6:
score: 100
Accepted
time: 0ms
memory: 3732kb
input:
18 X X Y Z X Y Y Y X X Z X X X Z X Z Z
output:
44 01100011001010000000000000000000000000000000
input:
44 01100011001010000000000000000000000000000000
output:
0 44 2
result:
ok n = 18, D = 44, L = 2
Test #7:
score: 100
Accepted
time: 2ms
memory: 3684kb
input:
3 X Y Z
output:
44 00100000000000000000000000000000000000000000
input:
44 00100000000000000000000000000000000000000000
output:
0 44 1
result:
ok n = 3, D = 44, L = 1
Test #8:
score: 100
Accepted
time: 4ms
memory: 3624kb
input:
3 Z Y X
output:
44 11000000000000000000000000000000000000000000
input:
44 11000000000000000000000000000000000000000000
output:
0 44 0
result:
ok n = 3, D = 44, L = 0
Test #9:
score: 100
Accepted
time: 6ms
memory: 5772kb
input:
18 X X X X X X X X X X X X X X X X X X
output:
44 10000000000000000000000000000000000000000000
input:
44 10000000000000000000000000000000000000000000
output:
0 44 0
result:
ok n = 18, D = 44, L = 0
Test #10:
score: 100
Accepted
time: 2ms
memory: 3700kb
input:
18 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
output:
44 00000000000000000000000000000000000000000000
input:
44 00000000000000000000000000000000000000000000
output:
0 44 0
result:
ok n = 18, D = 44, L = 0
Test #11:
score: 100
Accepted
time: 2ms
memory: 3648kb
input:
18 Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
output:
44 10101010000010000000000000000000000000000000
input:
44 10101010000010000000000000000000000000000000
output:
0 44 0
result:
ok n = 18, D = 44, L = 0
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 56ms
memory: 11852kb
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:
68772 110001000001111001010010010100010000001110001100010000011110010100100101000100000011100011000100000111100101001001010001000000111000110001000001111001010010010100010000001110001100010000011110010100100101000100000011100011000100000111100101001001010001000000111000110001000001111001010010010100...
input:
68772 110001000001111001010010010100010000001110001100010000011110010100100101000100000011100011000100000111100101001001010001000000111000110001000001111001010010010100010000001110001100010000011110010100100101000100000011100011000100000111100101001001010001000000111000110001000001111001010010010100...
output:
0 68772 6189
result:
wrong answer your query is valid but your solution is not optimal: read 6189 but expected 22133