QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#20611 | #3098. Ancient Machine | linmuhan# | 5 | 60ms | 10264kb | C++20 | 2.1kb | 2022-02-16 19:49:38 | 2023-01-17 10:46:39 |
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++) cout << bi[i]; puts ("");
// ll Tmp = 0; for (int i=62;i>=0;i-=2) Tmp += fib[i];
// cout << Tmp << endl;
for (int i=0;i<tot;i+=63) {
Sum = 0;
for (int j=0;j<63;j++) {
int t = j + i; if (t >= tot) break ;
if (bi[t]) 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 = 220021;
int bit[NTT];
ll fibb[NTT];
bool rem[NTT];
void Bruno(int N, int L, vector<int> A) {
// cout << L << endl;
// for (int i=0;i<A.size();i+=45) {
// for (int j=i;j<i+45&&j<A.size();j++) cout << A[j]; puts ("");
// }
fibb[0] = 1; fibb[1] = 2;
for (int i=2;i<=63;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=62;j>=0;j--) {
if (sum >= fibb[j]) {
sum -= fibb[j];
bit[j + p] = 1;
}
}
p += 63;
}
p = min (p, N);
if (p < N) p = N;
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: 4ms
memory: 3712kb
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: 2ms
memory: 3652kb
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: 3732kb
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: 0ms
memory: 3604kb
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: 4ms
memory: 3732kb
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: 4ms
memory: 3688kb
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: 4ms
memory: 3720kb
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: 3776kb
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: 4ms
memory: 3792kb
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: 4ms
memory: 3712kb
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: 4ms
memory: 3652kb
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: 100
Accepted
time: 46ms
memory: 10240kb
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:
69872 110001000001111001010010010100010000001110000010100111111100001101101101010101101101001000111001010100111010010000010111101010000110110001110000000110111110111111011110100100010100101000000111101100011101101110110011111001010011001111111000000110110110101000010110111111100001100000111001111001...
input:
69872 110001000001111001010010010100010000001110000010100111111100001101101101010101101101001000111001010100111010010000010111101010000110110001110000000110111110111111011110100100010100101000000111101100011101101110110011111001010011001111111000000110110110101000010110111111100001100000111001111001...
output:
0 69872 22133
result:
points 1.0 n = 100000, D = 69872, L = 22133
Test #13:
score: 100
Accepted
time: 60ms
memory: 10176kb
input:
100000 Z X X Y Z Z Z Y Z X Y Y Z X X Z Z Z Y Z X Y X Y X Z Y X Z X Y X Y Y Z X X Z X Z Y Z Y Z Z Z Y X Z X Z Y Y Y Z Y Z Y Z X Y X Z Z X Y X Y Z X Y Z Y X Y X X Z Z X Z X X Z X X X X Y X X Z Z X Y Y Y Y X Y X X Z Y Z Y Y Z X X Z Z Y Y X Z Y Y X Y Z Y Z Y Y Z Z X Z Y Z Z Z X Y Z Z X X X X Z Y X Y Y Z...
output:
69872 101101000001011100100001100001000100110001001111110000011000011100000010000110111100110000111111101001111101001110001001011000111110011100100011100000100000101110000000110100101000001001000000011101011100011010111110001100100101011100110111110010111001100110100110000100010110000111001100100011...
input:
69872 101101000001011100100001100001000100110001001111110000011000011100000010000110111100110000111111101001111101001110001001011000111110011100100011100000100000101110000000110100101000001001000000011101011100011010111110001100100101011100110111110010111001100110100110000100010110000111001100100011...
output:
0 69872 22275
result:
points 1.0 n = 100000, D = 69872, L = 22275
Test #14:
score: 0
Wrong Answer
time: 58ms
memory: 10264kb
input:
100000 X Z Y X Z X X Z Y Z Y Y Y Z Y Z X X Z X X Y Z X X Z Y X Y Y Z X Z Y Z X X X X Z X Y X Z X Z X X X Y X Y Z Z Z Z Z Z Z Z Y X Y Z X Z Y Z Y X Y Z Y Z Y X Y Z X Z Z Z Y X Y Y X X X X Y X X Y Z Z X Z Y Z Z Y X Y X Z Z Z X X Z X Z Z Z Z Y X Z Z X X Z Z Y X X Y Y Y X Y Y Y X X Y Y Z X Z Y Y X X Y Z...
output:
69872 111001100110000111001001101101000001001001000011000110111111101010011011100111110010001011011001110111001111011011000101010101010000000000111110101110001101010101011011000110001010100011110011010110000111110001100110000111000010010100101101111010110001001000000101100111010010110100001000100111...
input:
69872 111001100110000111001001101101000001001001000011000110111111101010011011100111110010001011011001110111001111011011000101010101010000000000111110101110001101010101011011000110001010100011110011010110000111110001100110000111000010010100101101111010110001001000000101100111010010110100001000100111...
output:
0 69872 22176
result:
wrong answer your query is valid but your solution is not optimal: read 22176 but expected 22177