結果
| 問題 | No.91 赤、緑、青の石 |
| コンテスト | |
| ユーザー |
kaito_tateyama
|
| 提出日時 | 2019-03-06 10:48:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 827 bytes |
| 記録 | |
| コンパイル時間 | 731 ms |
| コンパイル使用メモリ | 73,676 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-07 12:33:14 |
| 合計ジャッジ時間 | 1,799 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define P(x) cout << (x) << "\n"
#define D(x) cerr << (x) << "\n"
#define fcout cout << fixed << setprecision(18)
using i64 = long long int; // 10^18
i64 r, g, b;
bool isOK(i64 n)
{
vector<i64> v({r - n, g - n, b - n});
i64 c = 0;
for(auto i:v){
c += (i>0)?i/2:i;
}
return c>=0;
}
i64 binary_search()
{
i64 ng = 0;
i64 ok = pow(2, 24);
while (abs(ok - ng) > 1)
{
i64 mid = ng + (ok - ng) / 2;
if (!isOK(mid))
ok = mid;
else
ng = mid;
}
return ng;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> r >> g >> b;
P(binary_search());
return 0;
}
kaito_tateyama