QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#770959 | #4294. Bacteria | Justinshao | AC ✓ | 31ms | 8672kb | C++20 | 2.7kb | 2024-11-22 04:55:59 | 2024-11-22 04:56:00 |
Judging History
answer
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx,popcnt,sse4,abm")
#include<bits/stdc++.h>
using namespace std;
#define ZTMYACANESOCUTE ios_base::sync_with_stdio(0), cin.tie(0)
#define ll long long
#define ull unsigned long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << #x << " = " << x << '\n';
#define rep(X, a, b) for(int X = a; X < b; ++X)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pld pair<ld, ld>
#define ld long double
#define F first
#define S second
pii operator + (const pii &p1, const pii &p2) { return make_pair(p1.F + p2.F, p1.S + p2.S); }
pii operator - (const pii &p1, const pii &p2) { return make_pair(p1.F - p2.F, p1.S - p2.S); }
pll operator + (const pll &p1, const pll &p2) { return make_pair(p1.F + p2.F, p1.S + p2.S); }
pll operator - (const pll &p1, const pll &p2) { return make_pair(p1.F - p2.F, p1.S - p2.S); }
template<class T> bool chmin(T &a, T b) { return (b < a && (a = b, true)); }
template<class T> bool chmax(T &a, T b) { return (a < b && (a = b, true)); }
#define lpos pos << 1
#define rpos pos << 1 | 1
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << "," << p.second << ')'; }
template<typename A> ostream& operator << (ostream &os, const vector<A> &p) { for(const auto &a : p) os << a << " "; os << '\n'; return os; }
const int MAXN = 2e5 + 5, MOD = 998244353, IINF = 1e9 + 7, MOD2 = 1000000007;
const double eps = 1e-9;
const ll LINF = 1e18L + 5;
const int B = 320;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// int get_rand(int l, int r){ return uniform_int_distribution<int>(l, r)(rng); }
ll fpow(ll x, ll exp, ll mod = LLONG_MAX){ ll res = 1; while(exp){ if(exp & 1) res = res * x % mod; x = x * x % mod; exp >>= 1;} return res; }
void solve() {
int n; cin >> n;
int d = 0;
while ((1LL << d) * (1LL << (1LL << d)) <= (1LL << n)) d++;
d--;
vector<int> ans;
rep (i, 0, 1 << (1 << d)) {
rep (j, 0, 1 << d) ans.pb(i >> j & 1);
}
rep (i, 0, 1 << (1 << d)) {
if (ans.size() == 1 << n) break;
rep (j, 0, 1 << (1 << d)) {
if (ans.size() == 1 << n) break;
if (ans.size() < (1 << n) && j - i != 1 && !(j == 0 && i == (1 << (1 << d)) - 1)) {
rep (k, 0, 1 << d) ans.pb(i >> k & 1);
rep (k, 0, 1 << d) ans.pb(j >> k & 1);
}
}
}
while (ans.size() > 1 << n) ans.pop_back();
while (ans.size() < 1 << n) ans.pb(0);
for (int x : ans) cout << x;
}
int main() {
ZTMYACANESOCUTE;
int T = 1;
// cin >> T;
while (T--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3652kb
input:
3
output:
00100111
result:
ok ja=9, pa=9
Test #2:
score: 0
Accepted
time: 1ms
memory: 3856kb
input:
1
output:
01
result:
ok ja=3, pa=3
Test #3:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
2
output:
0100
result:
ok ja=5, pa=5
Test #4:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
4
output:
0010011100000001
result:
ok ja=13, pa=13
Test #5:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
6
output:
0000100001001100001010100110111000011001010111010011101101111111
result:
ok ja=37, pa=37
Test #6:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
10
output:
000010000100110000101010011011100001100101011101001110110111111100000000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111110000000100010001000110010000010100010101000011010001110100000011000100110000101100011011000001110001011100001111000...
result:
ok ja=277, pa=277
Test #7:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
5
output:
00100111000000010011100010101011
result:
ok ja=21, pa=21
Test #8:
score: 0
Accepted
time: 12ms
memory: 5184kb
input:
19
output:
000000001000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111100000000100010001000010010001100100000101000101010000110100011101000000110001001100001011000110110000011100010111000011110001111100000000100100001000100010011000100001001001010...
result:
ok ja=65813, pa=65813
Test #9:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
7
output:
00001000010011000010101001101110000110010101110100111011011111110000000000000100000011000000001000001010000001100000111000000001
result:
ok ja=53, pa=53
Test #10:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
8
output:
0000100001001100001010100110111000011001010111010011101101111111000000000000010000001100000000100000101000000110000011100000000100001001000001010000110100000011000010110000011100001111100000001000100010001100100000101000101010000110100011101000000110001001
result:
ok ja=85, pa=85
Test #11:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
9
output:
000010000100110000101010011011100001100101011101001110110111111100000000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111110000000100010001000110010000010100010101000011010001110100000011000100110000101100011011000001110001011100001111000...
result:
ok ja=149, pa=149
Test #12:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
11
output:
000000001000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111100000000100010001000010010001100100000101000101010000110100011101000000110001001100001011000110110000011100010111000011110001111100000000100100001000100010011000100001001001010...
result:
ok ja=533, pa=533
Test #13:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
12
output:
000000001000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111100000000100010001000010010001100100000101000101010000110100011101000000110001001100001011000110110000011100010111000011110001111100000000100100001000100010011000100001001001010...
result:
ok ja=789, pa=789
Test #14:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
13
output:
000000001000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111100000000100010001000010010001100100000101000101010000110100011101000000110001001100001011000110110000011100010111000011110001111100000000100100001000100010011000100001001001010...
result:
ok ja=1301, pa=1301
Test #15:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
14
output:
000000001000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111100000000100010001000010010001100100000101000101010000110100011101000000110001001100001011000110110000011100010111000011110001111100000000100100001000100010011000100001001001010...
result:
ok ja=2325, pa=2325
Test #16:
score: 0
Accepted
time: 2ms
memory: 3756kb
input:
15
output:
000000001000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111100000000100010001000010010001100100000101000101010000110100011101000000110001001100001011000110110000011100010111000011110001111100000000100100001000100010011000100001001001010...
result:
ok ja=4373, pa=4373
Test #17:
score: 0
Accepted
time: 3ms
memory: 3936kb
input:
16
output:
000000001000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111100000000100010001000010010001100100000101000101010000110100011101000000110001001100001011000110110000011100010111000011110001111100000000100100001000100010011000100001001001010...
result:
ok ja=8469, pa=8469
Test #18:
score: 0
Accepted
time: 4ms
memory: 3992kb
input:
17
output:
000000001000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111100000000100010001000010010001100100000101000101010000110100011101000000110001001100001011000110110000011100010111000011110001111100000000100100001000100010011000100001001001010...
result:
ok ja=16661, pa=16661
Test #19:
score: 0
Accepted
time: 4ms
memory: 4224kb
input:
18
output:
000000001000000001000000110000000010000010100000011000001110000000010000100100000101000011010000001100001011000001110000111100000000100010001000010010001100100000101000101010000110100011101000000110001001100001011000110110000011100010111000011110001111100000000100100001000100010011000100001001001010...
result:
ok ja=33045, pa=33045
Test #20:
score: 0
Accepted
time: 31ms
memory: 8672kb
input:
20
output:
000000000000000010000000000000000100000000000000110000000000000000100000000000001010000000000000011000000000000011100000000000000001000000000000100100000000000001010000000000001101000000000000001100000000000010110000000000000111000000000000111100000000000000001000000000001000100000000000010010000000...
result:
ok ja=131349, pa=131349