Submission #419786

# Submission time Handle Problem Language Result Execution time Memory
419786 2021-06-07T12:57:47 Z amoo_safar Ancient Machine (JOI21_ancient_machine) C++17
69 / 100
89 ms 9628 KB
#include "Anna.h"
#include <bits/stdc++.h>

#define pb push_back

using namespace std;

typedef long long ll;

const int bl = 76;
const int Log = 53;
ll fib[bl];

void Send(vector<int> seq){
	while((int) seq.size() % bl != 0)
		seq.pb(0);
	ll cd = 0;
	for(int i = 0; i < (int) seq.size(); i += bl){
		int j = i + bl - 1;
		while(i <= j){
			if(seq[j] == 0){
				j--;
				continue;
			}
			cd += fib[j - i];
			j -= 2;
		}
		for(int c = 0; c < Log; c++){
			Send(cd & 1);
			cd >>= 1;
		}
	}
}

void Anna(int _n, vector<char> S){
	fib[0] = 1;
	fib[1] = 2;
	for(int i = 2; i < bl; i++) fib[i] = fib[i - 1] + fib[i - 2];

	vector<int> V(_n, 0), seq;
	int fl = 0, fly = 1;
	for(int i = _n - 1; i >= 0; i--){
		if(S[i] == 'Y') fly = 1;
		if(S[i] == 'Z' && fly == 1)
			V[i] = 1, fly = 0;
	}
	int i = 0;
	for(auto c : S){
		if(fl == 0 && c == 'X'){
			fl = 1;
			seq.pb(1);
			seq.pb(0);
		} else {
			seq.pb(fl ? V[i] : 0);
		}
		i ++;
	}
	// Send(seq);
	for(auto x : seq)
		Send(x);
	// for(auto x : seq)
		// cerr << x;
	// cerr << '\n';
	
}
#include "Bruno.h"
#include <bits/stdc++.h>
#define pb push_back

using namespace std;

typedef long long ll;

const int bl = 76;
const int Log = 53;
ll fib2[bl];


void Bruno(int _n, int L, vector<int> B) {
	
	// vector<int> B;
	// for(int i = 0; i < L; i += bl){

	// }
	
	// L = B.size();
	for(int i = 0; i + 1 < L; i++)
		assert((B[i] == 0) || (B[i + 1] == 0));
	int fl = 0;
	vector<int> A;
	for(int i = 0; i < L; i++){
		if(B[i] == 0) A.pb(0);
		else {
			A.pb(1);
			if(!fl) i++;
			fl = 1;
		}
	}
	A.resize(_n, 0);
	L = _n;

	int cnt = 0;
	vector<int> mk(_n, 0);
	for (int i = 0; i < L; i++) {
		// cerr << "!" << A[i] << '\n';
		if(A[i] == 1){
			cnt ++;
			for(int j = i - 1; j >= 0; j--){
				if(A[j] == 1) break;
				Remove(j);
				mk[j] = 1;
			}
			if(cnt != 1){
				Remove(i);
				mk[i] = 1;
			};
		}
	}
	for(int i = 0; i < _n; i++) if(!mk[i]) Remove(i);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 576 KB Output is correct
2 Correct 0 ms 488 KB Output is correct
3 Correct 1 ms 576 KB Output is correct
4 Correct 1 ms 488 KB Output is correct
5 Correct 2 ms 488 KB Output is correct
6 Correct 2 ms 492 KB Output is correct
7 Correct 1 ms 576 KB Output is correct
8 Correct 1 ms 488 KB Output is correct
9 Correct 2 ms 616 KB Output is correct
10 Correct 1 ms 484 KB Output is correct
11 Correct 1 ms 488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 69 ms 9508 KB Partially correct
2 Partially correct 69 ms 9480 KB Partially correct
3 Partially correct 77 ms 9460 KB Partially correct
4 Partially correct 70 ms 9512 KB Partially correct
5 Partially correct 71 ms 9364 KB Partially correct
6 Partially correct 83 ms 9520 KB Partially correct
7 Partially correct 75 ms 9548 KB Partially correct
8 Partially correct 68 ms 9488 KB Partially correct
9 Partially correct 73 ms 9476 KB Partially correct
10 Partially correct 73 ms 9492 KB Partially correct
11 Partially correct 71 ms 9556 KB Partially correct
12 Partially correct 69 ms 9544 KB Partially correct
13 Partially correct 74 ms 9536 KB Partially correct
14 Partially correct 82 ms 9508 KB Partially correct
15 Partially correct 89 ms 9516 KB Partially correct
16 Partially correct 78 ms 9500 KB Partially correct
17 Partially correct 75 ms 9588 KB Partially correct
18 Partially correct 80 ms 9604 KB Partially correct
19 Partially correct 76 ms 9612 KB Partially correct
20 Partially correct 65 ms 9524 KB Partially correct
21 Partially correct 72 ms 9476 KB Partially correct
22 Partially correct 78 ms 9556 KB Partially correct
23 Partially correct 76 ms 9580 KB Partially correct
24 Partially correct 70 ms 9464 KB Partially correct
25 Partially correct 77 ms 9492 KB Partially correct
26 Partially correct 77 ms 9548 KB Partially correct
27 Partially correct 80 ms 9500 KB Partially correct
28 Partially correct 85 ms 9500 KB Partially correct
29 Partially correct 77 ms 9628 KB Partially correct
30 Partially correct 80 ms 9492 KB Partially correct
31 Partially correct 81 ms 9508 KB Partially correct
32 Partially correct 71 ms 9508 KB Partially correct
33 Partially correct 70 ms 9576 KB Partially correct