結果

問題 No.9 モンスターのレベル上げ
ユーザー fiordfiord
提出日時 2015-07-09 23:36:09
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 1,613 ms
コンパイル使用メモリ 152,416 KB
実行使用メモリ 11,488 KB
最終ジャッジ日時 2023-09-22 09:46:18
合計ジャッジ時間 7,896 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:17: warning: integer overflow in expression of type ‘int’ results in ‘2147483647’ [-Woverflow]
  int ans=(1<<31)-1;
          ~~~~~~~^~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;	cin>>n;
	vector<int> b(n);
	vector<pair<int,int> > a(n);
	for(int i=0;i<n;i++){
		cin>>a[i].first;	a[i].second=0;
	}
	for(int i=0;i<n;i++)	cin>>b[i];
	sort(a.begin(),a.end());
	int ans=(1<<31)-1;
	for(int s=0;s<n;s++){
		int temp=0;
		for(int i=s;i<n;i++){
			cout<<a[0].first<<"to"<<b[i]<<endl;
			a[0].first+=b[i]/2;
			a[0].second++;
			temp=max(temp,a[0].second);
			sort(a.begin(),a.end());
		}
		for(int i=0;i<s;i++){
			cout<<a[0].first<<"to"<<b[i]<<endl;
			a[0].first+=b[i]/2;
			a[0].second++;
			temp=max(temp,a[0].second);
			sort(a.begin(),a.end());
		}
		cout<<temp<<endl;
		ans=min(ans,temp);
	}
	cout<<ans<<endl;
	return 0;
}
0