提出 #57126292
ソースコード 拡げる
#include <bits/stdc++.h>
#define cerr cout << "in " << __LINE__ << "\t: "
using namespace std;
int n, k, cnt[510];
signed main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n >> k, fill(cnt + 1, cnt + n + 1, k);
if (n % 2 == 0) {
cout << n / 2 << " ";
cnt[n / 2]--;
for (int i = n; i >= 1; i--)
while (cnt[i]--) cout << i << " ";
cout << "\n";
}
else {
for (int i = 1; i <= k; i++)
cout << (n + 1) / 2 << " ";
cnt[(n + 1) / 2] = 0;
if (n != 1) {
cout << n / 2 << " ";
cnt[n / 2]--;
for (int i = n; i >= 1; i--)
while (cnt[i]--) cout << i << " ";
}
cout << "\n";
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Median of Good Sequences |
| ユーザ | cxm1024 |
| 言語 | C++ 20 (gcc 12.2) |
| 得点 | 400 |
| コード長 | 667 Byte |
| 結果 | AC |
| 実行時間 | 12 ms |
| メモリ | 3528 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt, 00-sample-004.txt |
| All | 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt, 00-sample-004.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt, 01-017.txt, 01-018.txt, 01-019.txt, 01-020.txt, 01-021.txt, 01-022.txt, 01-023.txt, 01-024.txt, 01-025.txt, 01-026.txt, 01-027.txt, 01-028.txt, 01-029.txt, 01-030.txt, 01-031.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-001.txt | AC | 1 ms | 3524 KiB |
| 00-sample-002.txt | AC | 1 ms | 3524 KiB |
| 00-sample-003.txt | AC | 1 ms | 3408 KiB |
| 00-sample-004.txt | AC | 1 ms | 3440 KiB |
| 01-001.txt | AC | 1 ms | 3460 KiB |
| 01-002.txt | AC | 3 ms | 3468 KiB |
| 01-003.txt | AC | 8 ms | 3456 KiB |
| 01-004.txt | AC | 1 ms | 3464 KiB |
| 01-005.txt | AC | 1 ms | 3524 KiB |
| 01-006.txt | AC | 3 ms | 3524 KiB |
| 01-007.txt | AC | 3 ms | 3528 KiB |
| 01-008.txt | AC | 2 ms | 3460 KiB |
| 01-009.txt | AC | 6 ms | 3400 KiB |
| 01-010.txt | AC | 3 ms | 3392 KiB |
| 01-011.txt | AC | 3 ms | 3456 KiB |
| 01-012.txt | AC | 1 ms | 3416 KiB |
| 01-013.txt | AC | 1 ms | 3412 KiB |
| 01-014.txt | AC | 1 ms | 3452 KiB |
| 01-015.txt | AC | 1 ms | 3392 KiB |
| 01-016.txt | AC | 1 ms | 3464 KiB |
| 01-017.txt | AC | 1 ms | 3528 KiB |
| 01-018.txt | AC | 1 ms | 3388 KiB |
| 01-019.txt | AC | 1 ms | 3468 KiB |
| 01-020.txt | AC | 3 ms | 3520 KiB |
| 01-021.txt | AC | 3 ms | 3332 KiB |
| 01-022.txt | AC | 4 ms | 3416 KiB |
| 01-023.txt | AC | 3 ms | 3444 KiB |
| 01-024.txt | AC | 6 ms | 3472 KiB |
| 01-025.txt | AC | 6 ms | 3460 KiB |
| 01-026.txt | AC | 6 ms | 3460 KiB |
| 01-027.txt | AC | 6 ms | 3456 KiB |
| 01-028.txt | AC | 11 ms | 3468 KiB |
| 01-029.txt | AC | 12 ms | 3472 KiB |
| 01-030.txt | AC | 12 ms | 3524 KiB |
| 01-031.txt | AC | 12 ms | 3460 KiB |