結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2020-11-06 23:14:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 441 bytes |
コンパイル時間 | 1,441 ms |
コンパイル使用メモリ | 166,360 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 07:29:29 |
合計ジャッジ時間 | 2,380 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h>using namespace std;const int INF = 100000000;int main(){int R, G, B;cin >> R >> G >> B;int tv = 0;int fv = INF;while (fv - tv > 1){int mid = (tv + fv) / 2;int a = max(R - mid, 0) / 2 + max(G - mid, 0) / 2 + max(B - mid, 0) / 2;int b = max(mid - R, 0) + max(mid - G, 0) + max(mid - B, 0);if (a >= b){tv = mid;} else {fv = mid;}}cout << tv << endl;}