結果

問題 No.91 赤、緑、青の石
ユーザー shimomireshimomire
提出日時 2014-12-07 19:30:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,652 bytes
コンパイル時間 916 ms
コンパイル使用メモリ 112,692 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-02 09:21:22
合計ジャッジ時間 2,245 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,384 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1 ms
4,380 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
4,376 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <ctime>
#include <iostream>// io
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>// container
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <algorithm>// other
#include <utility>
#include <complex>
#include <numeric>
#include <functional>
#include <random>
#include <regex>

using namespace std;
typedef long long ll;

#define ALL(c) (c).begin(),(c).end()
#define FOR(i,l,r) for(int i=(int)l;i<(int)r;++i)
#define REP(i,n) FOR(i,0,n)
#define FORr(i,l,r) for(int i=(int)r-1;i>=(int)l;--i)
#define REPr(i,n) FORr(i,0,n)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end())
//debug
#define DUMP(x)  cerr << #x << " = " << (x)
#define LINE()    cerr<< " (L" << __LINE__ << ")"

template<typename T,typename U> T pmod(T x,U M){return (x%M+M)%M;}

stringstream ss;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	ss   <<fixed <<setprecision(20);
	cout <<fixed <<setprecision(20);


	vector<ll> cs(3);REP(i,3)cin >> cs[i];

	ll l=0,r=100000000LL;
	while(r-l>1){
		vector<ll> cs2=cs;
		ll m=(l+r)/2;

		// cerr << m <<endl;

		ll fre2=max((cs2[2]-m)/2,0LL);
		ll fre1=max((cs2[1]-m)/2,0LL);
		ll fre0=max((cs2[0]-m)/2,0LL);
		int u=min(fre1,m-cs2[0]);
		cs2[0]+=u;fre1-=u;
		int u2=min(fre2,m-cs2[0]);
		cs2[0]+=u2;fre2-=u2;
		int u3=min(fre2,m-cs2[1]);
		cs2[1]+=u3;fre2-=u3;

		if(cs2[0]>=m && cs2[1]>=m && cs2[2]>=m){
			l=m;
		}else{
			r=m;
		}
	}
	cout << l <<endl;
 	return 0;
 }
0