QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#20584 | #3098. Ancient Machine | linmuhan# | 0 | 40ms | 11756kb | C++20 | 1.8kb | 2022-02-16 18:41:22 | 2023-01-17 10:45:48 |
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) {
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);
int t = -1;
for (int i=0;i<p;i++) {
if (bit[i]) {
t = i;
break ;
}
Remove (i); rem[i] = 1;
}
if (t == -1) {
for (int i=0;i<p;i++) Remove (i), rem[i] = 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;
}
}
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: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 4ms
memory: 5732kb
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 1
result:
wrong answer your query is valid but your solution is not optimal: read 1 but expected 3
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 40ms
memory: 11756kb
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 4893
result:
wrong answer your query is valid but your solution is not optimal: read 4893 but expected 22133