답안 #730875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
730875 2023-04-26T14:46:33 Z myrcella Ancient Machine (JOI21_ancient_machine) C++17
5 / 100
51 ms 8532 KB
//by szh
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}

#include "Anna.h"

void Anna(int N, std::vector<char> S) {
	bool ok = false;
	vector <int> tmp;
	ll dp[63];
	rep(i,0,N) {
		if (ok==false) {
			if (S[i]=='X') tmp.pb(1),ok=true;
			else tmp.pb(0);
		}
		else if (S[i]=='Z' and (i+1==N or S[i+1]!='Z')) tmp.pb(1);
		else tmp.pb(0);
	}
	while (SZ(tmp)%63!=0) tmp.pb(0);
	dp[0] = 1;
	dp[1] = 1, dp[2] = 2;
	rep(i,3,63) dp[i] = dp[i-1] + dp[i-2];
	int cur = 0;
	while (cur<N) {
		ll cnt = 0;
		rep(i,cur,cur+63) {
			if (tmp[i]==1) cnt += dp[cur+63-i-1];
		}
		rep(j,0,44) Send(((cnt>>j)&1));
		cur += 63;
	}
	return;
}

//by szh
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}

#include "Bruno.h"

void Bruno(int N, int L, std::vector<int> A) {
	vector <int> tmp;
	ll dp[63];
	dp[0] = 1;
	dp[1] = 1, dp[2] = 2;
	rep(i,3,63) dp[i] = dp[i-1] + dp[i-2];
	int cur = 0;
	while (cur<L) {
		ll cnt = 0;
		rep(i,cur,cur+44) if (A[i]) cnt += (1ll<<(i-cur));
		rep(j,0,63) {
			if (cnt>=dp[63-j-1]) {
				tmp.pb(1);
				cnt -= dp[63-j-1];
			} 
			else tmp.pb(0);
		}
		cur += 44;
	}
	bool ok = false;
	int pos = -1;
	vector <int> hi;
	rep(i,0,N) {
		if (ok==false) {
			if (tmp[i]==1) pos = i,ok=true;
			else Remove(i);
		}
		else {
			if (tmp[i]==1) {
				while (!hi.empty()) Remove(hi.back()),hi.pop_back();
				Remove(i);
			}
			else hi.pb(i);
		}
	}
	while (!hi.empty()) Remove(hi.back()),hi.pop_back();
	if (pos!=-1) Remove(pos);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 0 ms 520 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 512 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 1 ms 612 KB Output is correct
10 Correct 0 ms 544 KB Output is correct
11 Correct 1 ms 524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 51 ms 8532 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -