提出 #69118866
ソースコード 拡げる
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = (1 << 21);
int a[N];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
int m = (1 << n);
int base = k / m;
int remainder = k % m;
if (remainder == 0) {
// 所有元素相等
for (int i = 1; i <= m; i++) {
a[i] = base;
}
} else {
// 计算间隔,均匀分布 remainder 个 base+1
int interval = m / remainder;
for (int i = 1; i <= m; i++) {
if ((i - 1) % interval == 0 && remainder > 0) {
a[i] = base + 1;
remainder--;
} else {
a[i] = base;
}
}
}
// 输出不平衡度(0 或 1)
cout << (k % m == 0 ? 0 : 1) << '\n';
// 输出序列
for (int i = 1; i <= m; i++) {
cout << a[i] << " ";
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Stage Clear |
| ユーザ | a_computers_xh |
| 言語 | C++ 20 (gcc 12.2) |
| 得点 | 0 |
| コード長 | 1025 Byte |
| 結果 | WA |
| 実行時間 | 1 ms |
| メモリ | 3552 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 100 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_00.txt | WA | 1 ms | 3468 KiB |
| 00_sample_01.txt | WA | 1 ms | 3428 KiB |
| 00_sample_02.txt | WA | 1 ms | 3400 KiB |
| 01_random_03.txt | WA | 1 ms | 3464 KiB |
| 01_random_04.txt | WA | 1 ms | 3540 KiB |
| 01_random_05.txt | WA | 1 ms | 3408 KiB |
| 01_random_06.txt | WA | 1 ms | 3460 KiB |
| 01_random_07.txt | WA | 1 ms | 3344 KiB |
| 01_random_08.txt | WA | 1 ms | 3476 KiB |
| 01_random_09.txt | WA | 1 ms | 3468 KiB |
| 01_random_10.txt | WA | 1 ms | 3552 KiB |
| 01_random_11.txt | WA | 1 ms | 3340 KiB |
| 01_random_12.txt | WA | 1 ms | 3464 KiB |