結果
問題 |
No.91 赤、緑、青の石
|
ユーザー |
![]() |
提出日時 | 2014-12-07 21:09:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,681 bytes |
コンパイル時間 | 697 ms |
コンパイル使用メモリ | 77,784 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-11 17:16:15 |
合計ジャッジ時間 | 2,732 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 WA * 15 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <cstring> #include <ctime> #include <string> #include <vector> #include <stack> #include <queue> #include <map> #include <set> #include <algorithm> #include <cmath> #include <sstream> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; #define all(c) (c).begin(), (c).end() #define loop(i,a,b) for(ll i=a; i<ll(b); i++) #define rep(i,b) loop(i,0,b) #ifdef DEBUG #define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl) struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}}; #else #define dump(...) #endif typedef double R; const double pi = acos(-1); // 1 1 1 // 1 3 // 5 int solve(vi& a){ // rep(i,3){ // cout << a[i] << " "; // } // cout << endl; int res=0; { int x = min(a[1],a[2]/3); res += x; a[1]-=x; a[2]-=x*3; } { int y = min(a[2],a[1]/3); res += y; a[0]-=y; a[1]-=y*3; } { res += a[1]/5 + a[2]/5; } return res; } int main(){ int a[3]; while(cin>>a[0]){ rep(i,2)cin>>a[i+1]; int ans = 0; int m=min({a[0],a[1],a[2]}); sort(a,a+3); for(int i=0;i<=m;i++){ int t=0; t += i; vi b(a,a+3); rep(j,3)b[j]-=i; t += solve(b); ans = max(ans,t); dump(i,ans); } cout << ans << endl; } }