結果
| 問題 | No.91 赤、緑、青の石 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-11-25 18:08:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 623 bytes |
| 記録 | |
| コンパイル時間 | 1,368 ms |
| コンパイル使用メモリ | 161,932 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-07 12:32:45 |
| 合計ジャッジ時間 | 2,034 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int stones[3];
bool can(int x)
{
int rem = 0, need = 0;
for(int i = 0; i < 3; i++) {
if(stones[i] > x) {
rem += (stones[i] - x) / 2;
}
else {
need += x - stones[i];
}
}
if(rem >= need) return true;
else return false;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin >> stones[0] >> stones[1] >> stones[2];
int left = 0, right = 10000000;
while(right - left > 1) {
int mid = left + (right - left) / 2;
if(can(mid)) left = mid;
else right = mid;
}
cout << (can(right) ? right : left) << endl;
return 0;
}