結果
| 問題 |
No.2233 Average
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-03 21:50:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 302 ms / 2,000 ms |
| コード長 | 1,232 bytes |
| コンパイル時間 | 2,805 ms |
| コンパイル使用メモリ | 207,608 KB |
| 最終ジャッジ日時 | 2025-02-11 02:19:48 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef _RUTHEN
#include <debug.hpp>
#else
#define show(...) true
#endif
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int tt;
cin >> tt;
while (tt--) {
long long a, b, c, K;
cin >> a >> b >> c >> K;
map<tuple<long long, long long, long long>, int> mp;
V<tuple<long long, long long, long long>> his;
his.push_back({a, b, c});
mp[{a, b, c}] = 0;
for (int t = 1; t <= K; t++) {
long long na = (b + c) / 2, nb = (c + a) / 2, nc = (a + b) / 2;
show(na, nb, nc);
if (mp.count({na, nb, nc})) {
int cy = t - mp[{na, nb, nc}];
int rem = (K - t) % cy;
auto [ma, mb, mc] = his[mp[{na, nb, nc}] + rem];
a = ma, b = mb, c - mc;
break;
} else {
mp[{na, nb, nc}] = t;
his.push_back({na, nb, nc});
a = na, b = nb, c = nc;
}
show(mp, his);
}
cout << a + b + c << '\n';
}
return 0;
}