結果
問題 | No.2870 Dice Making |
ユーザー |
|
提出日時 | 2024-09-06 21:24:26 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 543 bytes |
コンパイル時間 | 772 ms |
コンパイル使用メモリ | 80,524 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-06 21:24:28 |
合計ジャッジ時間 | 2,227 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <iostream>using namespace std;int main () {int N, K; cin >> N >> K;if (N % K != 0) {cout << -1 << "\n";return 0;}if (N == 1) {if (K == 1) {cout << 1 << "\n";}else {cout << -1 << "\n";}return 0;}int rem = N;auto f = [&](int x) {cout << x;rem--;if (rem == 0) cout << "\n";else cout << " ";};for (int i = 0; i < N / K; i++) f(1);while (0 < rem) f(2);}