結果

問題 No.91 赤、緑、青の石
ユーザー sayusayu
提出日時 2014-12-10 10:45:37
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 704 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 74,232 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 12:08:50
合計ジャッジ時間 1,964 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define rep(i,x) for(int i=0;i<(int)(x);++i)

int main(){
	int ans, a[3], *mn, *mx;
	rep(i,3) cin >> a[i];
	ans = *min_element(a, a+3);
	rep(i,3) a[i] -= ans;
	while (*max_element(a, a+3) > 2) {
		mx = max_element(a, a+3);
		mn = min_element(a, a+3);
		++a[mn-a];
		a[mx-a] -= 2;
		if (*min_element(a, a+3)) {
			rep(i,3) --a[i];
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}
0