結果
| 問題 | No.91 赤、緑、青の石 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-11-25 18:08:41 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| + 365µs | |
| コード長 | 623 bytes |
| 記録 | |
| コンパイル時間 | 874 ms |
| コンパイル使用メモリ | 180,464 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-19 04:59:17 |
| 合計ジャッジ時間 | 2,893 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}