結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2018-10-12 15:10:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 521 bytes |
コンパイル時間 | 1,716 ms |
コンパイル使用メモリ | 167,592 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 07:17:03 |
合計ジャッジ時間 | 2,396 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include<bits/stdc++.h>using namespace std;using Int = long long;template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}//INSERT ABOVE HEREsigned main(){int a,b,c;cin>>a>>b>>c;int l=0,r=1e8;while(l+1<r){int m=(l+r)>>1;int x=a-m,y=b-m,z=c-m;int p=max(0,-x)+max(0,-y)+max(0,-z);int q=max(0,x)/2+max(0,y)/2+max(0,z)/2;if(p<=q) l=m;else r=m;}cout<<l<<endl;return 0;}