답안 #965632

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
965632 2024-04-19T03:22:17 Z emptypringlescan Ancient Machine (JOI21_ancient_machine) C++17
99 / 100
54 ms 9872 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
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(int32_t 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<(41-N%40)%40; i++) old.push_back(0);
	for(int i=0; i<(int)old.size()-1; i++) if(old[i+1]&old[i]) old[i]=0;
	for(int i=0; i<N; i+=40){
		vector<int> yey;
		for(int j=0; j<40; j++){
			yey.push_back(old[i+j]);
		}
		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;
#define int long long
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(int32_t N, int32_t L, std::vector<int32_t> b) {
	vector<int> A;
	assert(L%28==0||L%28==1);
	for(int i=0; i<L-L%28; i+=28){
		int x=0;
		for(int j=0; j<28; j++){
			if(b[i+j]) x+=1ll<<j;
		}
		vector<int> yey=htk(x);
		for(int j:yey) A.push_back(j);
	}
	stack<int> st;
	bool s=true;
	if(L%28==1) s=false;
	for(int i=0; i<N; i++){
		if(A[i]==0&&s==false) st.push(i);
		else{
			while(st.size()>1){
				Remove(st.top());
				st.pop();
			}
			Remove(i);
			if(A[i]==1) s=false;
		}
	}
	while(!st.empty()){
		Remove(st.top());
		st.pop();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 792 KB Output is correct
2 Correct 0 ms 784 KB Output is correct
3 Correct 0 ms 780 KB Output is correct
4 Correct 1 ms 1296 KB Output is correct
5 Correct 0 ms 792 KB Output is correct
6 Correct 0 ms 792 KB Output is correct
7 Correct 0 ms 780 KB Output is correct
8 Correct 1 ms 776 KB Output is correct
9 Correct 1 ms 792 KB Output is correct
10 Correct 1 ms 784 KB Output is correct
11 Correct 0 ms 792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 41 ms 9072 KB Partially correct
2 Correct 49 ms 9208 KB Output is correct
3 Partially correct 40 ms 9532 KB Partially correct
4 Correct 40 ms 9516 KB Output is correct
5 Correct 43 ms 9452 KB Output is correct
6 Partially correct 43 ms 9504 KB Partially correct
7 Partially correct 54 ms 9460 KB Partially correct
8 Partially correct 41 ms 9228 KB Partially correct
9 Partially correct 44 ms 9320 KB Partially correct
10 Partially correct 53 ms 9472 KB Partially correct
11 Partially correct 40 ms 9520 KB Partially correct
12 Correct 40 ms 9344 KB Output is correct
13 Partially correct 42 ms 9472 KB Partially correct
14 Partially correct 46 ms 9200 KB Partially correct
15 Partially correct 44 ms 9456 KB Partially correct
16 Partially correct 42 ms 9572 KB Partially correct
17 Partially correct 40 ms 9872 KB Partially correct
18 Partially correct 39 ms 9392 KB Partially correct
19 Partially correct 44 ms 9460 KB Partially correct
20 Partially correct 46 ms 9568 KB Partially correct
21 Partially correct 45 ms 9588 KB Partially correct
22 Partially correct 40 ms 9392 KB Partially correct
23 Partially correct 44 ms 9420 KB Partially correct
24 Partially correct 44 ms 9464 KB Partially correct
25 Partially correct 41 ms 9280 KB Partially correct
26 Partially correct 39 ms 9504 KB Partially correct
27 Correct 49 ms 9312 KB Output is correct
28 Partially correct 40 ms 9460 KB Partially correct
29 Partially correct 40 ms 9360 KB Partially correct
30 Correct 47 ms 9476 KB Output is correct
31 Partially correct 47 ms 9496 KB Partially correct
32 Correct 41 ms 9388 KB Output is correct
33 Partially correct 40 ms 9344 KB Partially correct