結果
問題 |
No.91 赤、緑、青の石
|
ユーザー |
![]() |
提出日時 | 2019-03-06 10:45:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 875 bytes |
コンパイル時間 | 865 ms |
コンパイル使用メモリ | 77,156 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-23 14:32:04 |
合計ジャッジ時間 | 2,017 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 28 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) #define P(x) cout << (x) << "\n" #define D(x) cerr << (x) << "\n" #define fcout cout << fixed << setprecision(18) using i64 = long long int; // 10^18 i64 r, g, b; bool isOK(i64 n) { vector<i64> v({r - n, g - n, b - n}); i64 c = 0; for(auto i:v){ c += (i>0)?i/2:i; } return c<0; } i64 binary_search() { i64 ng = 0; i64 ok = pow(2, 24); while (abs(ok - ng) > 1) { i64 mid = ng + (ok - ng) / 2; cerr << ng << " " << ok <<"\n"; if (isOK(mid)) ok = mid; else ng = mid; } return ok; } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> r >> g >> b; P(binary_search()); return 0; }