結果
| 問題 |
No.3245 Payment with 8-rep Currency
|
| コンテスト | |
| ユーザー |
yamate11
|
| 提出日時 | 2025-08-23 11:30:21 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,543 bytes |
| コンパイル時間 | 3,026 ms |
| コンパイル使用メモリ | 281,044 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-08-23 11:30:28 |
| 合計ジャッジ時間 | 6,755 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 30 |
ソースコード
#include <bits/stdc++.h>
#include <cassert>
using namespace std;
using ll = long long int;
using u64 = unsigned long long;
using pll = pair<ll, ll>;
// #include <atcoder/all>
// using namespace atcoder;
#define REP(i, a, b) for (ll i = (a); i < (b); i++)
#define REPrev(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(coll) (coll).begin(), (coll).end()
#define SIZE(v) ((ll)((v).size()))
#define REPOUT(i, a, b, exp, sep) REP(i, (a), (b)) cout << (exp) << (i + 1 == (b) ? "" : (sep)); cout << "\n"
// @@ !! LIM()
int main(/* int argc, char *argv[] */) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout << setprecision(20);
ll t0 = 1000;
using sta = tuple<ll, ll, ll>;
vector<sta> vec(t0, sta(-1, -1, -1));
REP(i, 0, 22) REP(j, 0, 22) REP(k, 0, 22) {
ll s = i + j + k;
ll t = 111 * i + 11 * j + 1 * k;
if (t < t0 and get<0>(vec[t]) < 0 and 2 * i < s and 2 * j < s and 2 * k < s) vec[t] = sta(i, j, k);
}
auto report = [&](ll i, ll j, ll k) -> void {
cout << i << " " << j << " " << k << " " << "0\n";
};
auto solve = [&]() -> void {
ll N; cin >> N;
if (N % 8 != 0) {
cout << -1 << "\n";
}else {
N /= 8;
if (N < t0) {
auto [i, j, k] = vec[N];
if (i < 0) cout << -1 << "\n";
else report(i, j, k);
}else {
ll a = 123 * 6 + N % 123;
auto [i, j, k] = vec[a];
ll base = (N - a) / 123;
report(base + i, base + j, base + k);
}
}
};
ll T; cin >> T;
REP(t, 0, T) solve();
return 0;
}
yamate11