結果
| 問題 |
No.2870 Dice Making
|
| コンテスト | |
| ユーザー |
ななり
|
| 提出日時 | 2024-09-09 22:54:30 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 772 bytes |
| コンパイル時間 | 414 ms |
| コンパイル使用メモリ | 33,792 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-09 22:54:32 |
| 合計ジャッジ時間 | 2,210 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#pragma GCC diagnostic ignored "-Wunused-result"
//#pragma GCC optimize "Ofast"
#include <cstdint>
#include <cstdio>
#include <cstring>
uint8_t c, ostr[200], *optr = ostr;
int main() {
fseek(stdin, 0, 2);
uint8_t istrlen = ftell(stdin), istr[istrlen], *iptr = istr, n = 0, k = 0;
fseek(stdin, 0, 0);
fread(istr, 1, istrlen, stdin);
while ((c = *iptr++) >= '0') n = n * 10 + (c - '0');
while ((c = *iptr++) >= '0') k = k * 10 + (c - '0');
if (n % k == 0) {
int8_t t = n / k, r = n - t;
while (--t >= 0) {
memcpy(optr, "1 ", 2);
optr += 2;
}
while (--r >= 0) {
memcpy(optr, "2 ", 2);
optr += 2;
}
}
else {
memcpy(optr, "-1", 2);
optr += 2;
}
fwrite(ostr, 1, optr - ostr, stdout);
return 0;
}
ななり