結果
| 問題 | No.91 赤、緑、青の石 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-03 17:45:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 616 bytes |
| 記録 | |
| コンパイル時間 | 477 ms |
| コンパイル使用メモリ | 61,080 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-12-07 12:31:41 |
| 合計ジャッジ時間 | 1,595 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
ソースコード
#include<iostream>
using namespace std;
int v[3];
bool check(int n){
int R[3];
long long changeable = 0;
for(int i = 0; i < 3; i++){
R[i] = v[i]-n;
changeable += (R[i] > 0) ? R[i]/2 : R[i];
}
return changeable >= 0;
}
int binarySearch(int low, int high){ // includes low, excludes high
if(low == high-1) return low;
int mid = (low+high)/2;
if(check(mid)){
return binarySearch(mid, high);
}else{
return binarySearch(low, mid);
}
}
int main(){
cin >> v[0] >> v[1] >> v[2];
cout << binarySearch(0, 1<<24) << endl;
return 0;
}