結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
28,652 KB
testcase_01 AC 24 ms
28,400 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 = 80000;
const int Max_ans = 80;

int save[Max_monster];
int my[Max_ans][Max_lv] = {0};	//lv1 → 位置0
int com[Max_monster];


int main(){
	int n;
	int in;
	int ans = 999;
	int ansmax;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> save[i];
	}
	
	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<Max_ans; i++){
			for(int j=0; j<Max_lv; j++){
				my[i][j] = 0;
			}
		}
		for(int i=0;i<Max_monster; i++){
			my[0][ save[i] - 1] ++;
		}
		
		//戦闘
		int i=starti;
		int lvnow = 0;
		int ansnow = 0;
		int ansmax = -1;
		do{
			//次に戦う味方を探す
			while(my[ansnow][lvnow] == 0){
				ansnow ++;
				if(ansnow >= Max_ans){
					lvnow ++;	//注意
					ansnow = 0;
				}
			}
			
			//LVUP
			my[ansnow][lvnow] --;
			my[ansnow + 1][lvnow + com[i]/2] ++;
			if(ansnow + 1 > ansmax){
				ansmax = ansnow + 1;
			}
			//cout << "戦闘" << ansnow << "→" << ansnow+1 << "\tLV" << lvnow << "→" << lvnow + com[i]/2 << endl;
			
			//next
			i ++;
			if(i >= n){
				i=0;
			}
		}while(i != starti);
		
		//答え更新
		if(ansmax < ans){
			ans = ansmax;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}
0