結果
| 問題 | No.91 赤、緑、青の石 |
| コンテスト | |
| ユーザー |
sntea
|
| 提出日時 | 2015-10-30 01:48:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 5,000 ms |
| コード長 | 1,231 bytes |
| 記録 | |
| コンパイル時間 | 592 ms |
| コンパイル使用メモリ | 85,480 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-07 12:23:38 |
| 合計ジャッジ時間 | 2,263 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:60:29: warning: ‘p’ may be used uninitialized [-Wmaybe-uninitialized]
60 | in[p]-=2;
| ~~~~^
main.cpp:52:29: note: ‘p’ was declared here
52 | int p;
| ^
ソースコード
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <utility>
#include <cstdio>
using namespace std;
#define endl '\n'
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
typedef pair<int,int> P;
typedef long long int LL;
typedef pair<LL,LL> LP;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int ans=0;
int in[3];
REP(i,3) cin>>in[i];
int mi=min({in[0],in[1],in[2]}),ma=max({in[0],in[1],in[2]});
ans+=mi;
in[0]-=mi; in[1]-=mi; in[2]-=mi;
mi=min({in[0],in[1],in[2]});
ma=max({in[0],in[1],in[2]});
while(true){
int hu=0;
REP(i,3) if(in[i]==0){
in[i]++;
hu++;
}
bool f=false;
REP(i,hu){
int p;
int tm=-1;
REP(j,3){
if(tm<in[j]){
tm=in[j];
p=j;
}
}
in[p]-=2;
if(in[p]<1) f=true;
}
if(f) break;
REP(i,3) in[i]--;
ans++;
}
cout<<ans<<endl;
return 0;
}
sntea