//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 (tmp.back()!=1 and 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] = 2;
rep(i,2,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] = 2;
rep(i,2,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 |
524 KB |
Output is correct |
2 |
Correct |
1 ms |
512 KB |
Output is correct |
3 |
Correct |
1 ms |
520 KB |
Output is correct |
4 |
Correct |
1 ms |
520 KB |
Output is correct |
5 |
Correct |
1 ms |
512 KB |
Output is correct |
6 |
Correct |
1 ms |
608 KB |
Output is correct |
7 |
Correct |
1 ms |
520 KB |
Output is correct |
8 |
Correct |
1 ms |
520 KB |
Output is correct |
9 |
Correct |
2 ms |
524 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
2 ms |
612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
61 ms |
8300 KB |
Output is correct |
2 |
Correct |
54 ms |
8316 KB |
Output is correct |
3 |
Incorrect |
56 ms |
8416 KB |
Wrong Answer [6] |
4 |
Halted |
0 ms |
0 KB |
- |