QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#178486 | #4294. Bacteria | NYCU_Yamada | AC ✓ | 6ms | 3900kb | C++20 | 2.4kb | 2023-09-14 01:02:24 | 2023-09-14 01:02:25 |
Judging History
answer
#ifndef Yamada
#define Yamada
#include Yamada __FILE__ Yamada
template <size_t b>
void draw(int N) {
int cnt = 0;
const int n = int(1) << (b-1);
const int sz = int(1) << n;
vector<int> a(sz); iota(ALL(a), 0);
int haha = N / (2 * sz * n);
for (int i = 0; i < sz; ++i) {
if(haha) {
for (int j = 0; j < haha; ++j) {
cnt += 2 * n;
cout << bitset<n>(i) << bitset<n>(j);
}
}
else {
cout << bitset<n>(i);
}
if (cnt == N) break;
}
cout << "\n";
debug(N, cnt);
}
void solve() {
int N; cin >> N;
if (N < 1 + (1 << 1)) draw<1>(int(1) << N);
else if (N < 2 + (1 << 2)) draw<2>(int(1) << N);
else if (N < 3 + (1 << 3)) draw<3>(int(1) << N);
else if (N < 4 + (1 << 4)) draw<4>(int(1) << N);
else if (N < 5 + (1 << 5)) draw<5>(int(1) << N);
}
signed main() {
IOS();
int t = 1; // cin >> t;
for (int i = 1; i <= t; ++i) solve();
return 0;
}
#else
#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
// #define double __float80
using pii = pair<int, int>;
template <typename T> using MaxHeap = std::priority_queue<T>;
template <typename T> using MinHeap = std::priority_queue<T, vector<T>, greater<T>>;
// #define X first
// #define Y second
#define eb emplace_back
#define ef emplace_front
#define ee emplace
#define pb pop_back
#define pf pop_front
#define SZ(a) (int)((a).size())
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#ifdef local
#define IOS() void()
#define debug(...) \
fprintf(stderr, "%sAt [%s], line %d: (%s) = ", "\u001b[33m", __FUNCTION__, __LINE__, #__VA_ARGS__), \
_do(__VA_ARGS__), fprintf(stderr, "%s", "\u001b[0m")
template <typename T> void _do(T &&_t) {cerr << _t << "\n";}
template <typename T, typename ...U> void _do(T &&_t, U &&..._u) {cerr << _t << ", ", _do(_u...);}
#else
#define IOS() ios_base::sync_with_stdio(0); cin.tie(0)
#define debug(...) void()
#define endl '\n'
#endif
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T, typename U> bool chmin(T &lhs, U rhs) {return lhs > rhs ? lhs = rhs, 1 : 0;}
template <typename T, typename U> bool chmax(T &lhs, U rhs) {return lhs < rhs ? lhs = rhs, 1 : 0;}
#endif
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
input:
3
output:
00011011
result:
ok ja=9, pa=9
Test #2:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
1
output:
01
result:
ok ja=3, pa=3
Test #3:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
2
output:
0010
result:
ok ja=5, pa=5
Test #4:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
4
output:
0000010010001100
result:
ok ja=13, pa=13
Test #5:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
6
output:
0000000100100011010001010110011110001001101010111100110111101111
result:
ok ja=37, pa=37
Test #6:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
10
output:
000000000000000100000010000000110000010000000101000001100000011100010000000100010001001000010011000101000001010100010110000101110010000000100001001000100010001100100100001001010010011000100111001100000011000100110010001100110011010000110101001101100011011101000000010000010100001001000011010001000100...
result:
ok ja=277, pa=277
Test #7:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
5
output:
00000001010001011000100111001101
result:
ok ja=21, pa=21
Test #8:
score: 0
Accepted
time: 3ms
memory: 3628kb
input:
19
output:
000000000000000000000000000000010000000000000010000000000000001100000000000001000000000000000101000000000000011000000000000001110000000000001000000000000000100100000000000010100000000000001011000000000000110000000000000011010000000000001110000000000000111100000000000100000000000000010001000000000001...
result:
ok ja=65813, pa=65813
Test #9:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
7
output:
00000000000100000010000000110000010000000101000001100000011100001000000010010000101000001011000011000000110100001110000011110000
result:
ok ja=53, pa=53
Test #10:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
8
output:
0000000000000001000100000001000100100000001000010011000000110001010000000100000101010000010100010110000001100001011100000111000110000000100000011001000010010001101000001010000110110000101100011100000011000001110100001101000111100000111000011111000011110001
result:
ok ja=85, pa=85
Test #11:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
9
output:
000000000000000100000010000000110001000000010001000100100001001100100000001000010010001000100011001100000011000100110010001100110100000001000001010000100100001101010000010100010101001001010011011000000110000101100010011000110111000001110001011100100111001110000000100000011000001010000011100100001001...
result:
ok ja=149, pa=149
Test #12:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
11
output:
000000000000000100000010000000110000010000000101000001100000011100001000000010010000101000001011000011000000110100001110000011110001000000010001000100100001001100010100000101010001011000010111000110000001100100011010000110110001110000011101000111100001111100100000001000010010001000100011001001000010...
result:
ok ja=533, pa=533
Test #13:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
12
output:
000000000000000000000001000000000000001000000000000000110000000000000100000000000000010100000000000001100000000000000111000000000000100000000000000010010000000000001010000000000000101100000000000011000000000000001101000000000000111000000000000011110000000000010000000000000001000100000000000100100000...
result:
ok ja=789, pa=789
Test #14:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
13
output:
000000000000000000000000000000010000000100000000000000010000000100000010000000000000001000000001000000110000000000000011000000010000010000000000000001000000000100000101000000000000010100000001000001100000000000000110000000010000011100000000000001110000000100001000000000000000100000000001000010010000...
result:
ok ja=1301, pa=1301
Test #15:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
14
output:
000000000000000000000000000000010000000000000010000000000000001100000001000000000000000100000001000000010000001000000001000000110000001000000000000000100000000100000010000000100000001000000011000000110000000000000011000000010000001100000010000000110000001100000100000000000000010000000001000001000000...
result:
ok ja=2325, pa=2325
Test #16:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
15
output:
000000000000000000000000000000010000000000000010000000000000001100000000000001000000000000000101000000000000011000000000000001110000000100000000000000010000000100000001000000100000000100000011000000010000010000000001000001010000000100000110000000010000011100000010000000000000001000000001000000100000...
result:
ok ja=4373, pa=4373
Test #17:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
16
output:
000000000000000000000000000000010000000000000010000000000000001100000000000001000000000000000101000000000000011000000000000001110000000000001000000000000000100100000000000010100000000000001011000000000000110000000000000011010000000000001110000000000000111100000001000000000000000100000001000000010000...
result:
ok ja=8469, pa=8469
Test #18:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
17
output:
000000000000000000000000000000010000000000000010000000000000001100000000000001000000000000000101000000000000011000000000000001110000000000001000000000000000100100000000000010100000000000001011000000000000110000000000000011010000000000001110000000000000111100000000000100000000000000010001000000000001...
result:
ok ja=16661, pa=16661
Test #19:
score: 0
Accepted
time: 2ms
memory: 3656kb
input:
18
output:
000000000000000000000000000000010000000000000010000000000000001100000000000001000000000000000101000000000000011000000000000001110000000000001000000000000000100100000000000010100000000000001011000000000000110000000000000011010000000000001110000000000000111100000000000100000000000000010001000000000001...
result:
ok ja=33045, pa=33045
Test #20:
score: 0
Accepted
time: 6ms
memory: 3884kb
input:
20
output:
000000000000000000000000000000010000000000000010000000000000001100000000000001000000000000000101000000000000011000000000000001110000000000001000000000000000100100000000000010100000000000001011000000000000110000000000000011010000000000001110000000000000111100000000000100000000000000010001000000000001...
result:
ok ja=131349, pa=131349