結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2016-09-22 21:14:37 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 750 bytes |
コンパイル時間 | 1,321 ms |
コンパイル使用メモリ | 159,076 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-24 07:00:18 |
合計ジャッジ時間 | 2,308 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, j) for(int i=0; i < (int)(j); i++) template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; } class Solver { public: bool solve() { vector<int> a(3); cin >> a; auto check = [&](int n) { int left = 0; for(int m : a) left += (m > n ? (m - n) / 2 : m - n); return left >= 0; }; int l = 0, r = 1e7 + 1; while(l + 1 < r) { int m = (l + r) / 2; (check(m) ? l : r) = m; } cout << l << endl; return 0; } }; int main() { cin.tie(0); ios::sync_with_stdio(false); Solver s; s.solve(); return 0; }