結果

問題 No.9 モンスターのレベル上げ
ユーザー 158b158b
提出日時 2015-05-14 19:34:45
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,443 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 65,864 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 07:50:08
合計ジャッジ時間 3,937 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 WA -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

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,j;
	long swap;
	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];
	}
	
	//ソート関数にてソート
	sort(save, save+n);
	
	//計算部分
	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{
			//battle
			my[0] += com[i] / 2 * 10000 + 1;
			
			//my[0]だけ移動
			swap = my[0];
			j = 1;
			while(swap > my[j] && j<Max_monster){
				my[j-1] = my[j];
				j ++;
			}
			my[j-1] = swap;
			
			//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