답안 #965446

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
965446 2024-04-18T14:52:12 Z emptypringlescan Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
50 ms 8308 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
long long lt[]={1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296};
int kth(vector<int> bits){
	int l=bits.size();
	int ret=0;
	for(int i=0; i<l; i++){
		if(bits[i]) ret+=lt[l-i-1];
	}
	return ret;
}
void Anna(int N, vector<char> S){
	bool st=true;
	vector<int> old;
	int fir=0;
	for(int i=0; i<N; i++){
		if(st&&S[i]=='X') old.push_back(0),st=false,fir=i;
		else if(st||S[i]=='Z') old.push_back(1);
		else old.push_back(0);
	}
	for(int i=0; i<(40-N%40)%40; i++) old.push_back(0);
	for(int i=0; i<N; i+=40){
		vector<int> yey;
		for(int j=0; j<39; j++){
			if(old[i+j]==1&&old[i+j+1]==1) yey.push_back(0);
			else yey.push_back(old[i+j]);
		}
		yey.push_back(old[i+39]);
		int x=kth(yey);
		for(int j=0; j<28; j++) Send((x>>j)&1);
	}
	if(fir==0) Send(0);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
long long lt[]={1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296};
vector<int> htk(int x){
	vector<int> ret(40);
	for(int i=0; i<40; i++){
		if(x>=lt[40-i-1]){
			ret[i]=1;
			x-=lt[40-i-1];
		}
	}
	return ret;
}
void Bruno(int N, int L, std::vector<int> b) {
	vector<int> A;
	for(int i=0; i<L; i+=28){
		int x=0;
		for(int j=0; j<28; j++){
			if(b[j]) x+=1<<j;
		}
		vector<int> yey=htk(x);
		for(int j:yey) A.push_back(j);
	}
	stack<int> st;
	bool s=true;
	for(int i=0; i<N; i++){
		if(A[i]==0) st.push(i);
		else{
			while(st.size()>1){
				Remove(st.top());
				st.pop();
			}
			Remove(i);
			if(s&&L%28==0){
				Remove(st.top());
				st.pop();
				s=false;
			}
		}
	}
	while(!st.empty()){
		Remove(st.top());
		st.pop();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 772 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 50 ms 8308 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -