結果

問題 No.9 モンスターのレベル上げ
ユーザー 158b158b
提出日時 2015-05-14 16:25:50
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,419 bytes
コンパイル時間 450 ms
コンパイル使用メモリ 62,464 KB
実行使用メモリ 15,372 KB
最終ジャッジ日時 2023-09-20 07:48:21
合計ジャッジ時間 29,790 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
15,160 KB
testcase_01 AC 13 ms
15,064 KB
testcase_02 AC 2,554 ms
15,076 KB
testcase_03 AC 2,058 ms
15,072 KB
testcase_04 AC 1,553 ms
15,184 KB
testcase_05 AC 1,297 ms
15,072 KB
testcase_06 AC 789 ms
15,068 KB
testcase_07 AC 118 ms
15,152 KB
testcase_08 AC 932 ms
15,096 KB
testcase_09 AC 2,501 ms
15,128 KB
testcase_10 AC 7 ms
15,280 KB
testcase_11 AC 2,560 ms
15,372 KB
testcase_12 WA -
testcase_13 AC 2,662 ms
15,100 KB
testcase_14 AC 2,416 ms
15,072 KB
testcase_15 AC 2,343 ms
15,188 KB
testcase_16 AC 338 ms
15,120 KB
testcase_17 AC 1,908 ms
15,072 KB
testcase_18 AC 1,766 ms
15,068 KB
testcase_19 AC 254 ms
15,108 KB
権限があれば一括ダウンロードができます

ソースコード

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;

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