結果
| 問題 |
No.91 赤、緑、青の石
|
| コンテスト | |
| ユーザー |
kaito_tateyama
|
| 提出日時 | 2019-03-06 10:48:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 827 bytes |
| コンパイル時間 | 766 ms |
| コンパイル使用メモリ | 76,384 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 07:18:01 |
| 合計ジャッジ時間 | 1,662 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
ソースコード
#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