結果

問題 No.9 モンスターのレベル上げ
ユーザー 158b158b
提出日時 2015-05-14 19:17:23
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,314 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 65,796 KB
実行使用メモリ 8,036 KB
最終ジャッジ日時 2023-09-20 07:49:42
合計ジャッジ時間 7,121 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
using namespace std;

const int Max_monster = 1500;
const int Max_lv = 100000;
const int Max_ans = 30;

long save[Max_monster];
long my[Max_monster];
int com[Max_monster];

//もっと単純に!
//save,my体裁 lv*10000+戦闘回数
int main(){
	int n;
	int in;
	int ans = 999;
	int ansmax;
	int i;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> in;
		save[i] = in * 10000;
	}
	
	for(int i=0; i<n; i++){
		cin >> com[i];
	}
	
	//計算部分
	for(int starti=0; starti<n; starti++){
		//cout << "-----" << starti << "-----" << endl;
		//my表作成
		for(int i=0; i<n; i++){
			my[i] = save[i];
		}
		
		//戦闘
		i=starti;
		do{
			//次に戦う味方を探す
			//ソート関数にてソート
			sort(my, my+n);
			
			//battle
			my[0] += com[i] / 2 * 10000 + 1;
			
			//cout << "戦闘" << ansnow << "→" << ansnow+1 << "\tLV" << lvnow << "→" << lvnow + com[i]/2 << endl;
			
			//next
			i ++;
			if(i >= n){
				i=0;
			}
		}while(i != starti);
		
		//最高戦闘回数チェックとans更新
		ansmax = -1;
		for(int i=0; i<Max_monster; i++){
			if(my[i] % 10000 > ansmax){
				ansmax = my[i] % 10000;
			}
		}
		
		if(ansmax < ans){
			ans = ansmax;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}
0