結果

問題 No.9 モンスターのレベル上げ
ユーザー 158b158b
提出日時 2015-05-14 16:15:34
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,423 bytes
コンパイル時間 1,043 ms
コンパイル使用メモリ 63,864 KB
実行使用メモリ 7,576 KB
最終ジャッジ日時 2023-09-20 07:43:43
合計ジャッジ時間 9,660 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
7,292 KB
testcase_01 AC 7 ms
7,284 KB
testcase_02 AC 791 ms
7,280 KB
testcase_03 AC 646 ms
7,288 KB
testcase_04 RE -
testcase_05 AC 406 ms
7,360 KB
testcase_06 AC 243 ms
7,344 KB
testcase_07 AC 38 ms
7,336 KB
testcase_08 AC 286 ms
7,440 KB
testcase_09 RE -
testcase_10 AC 4 ms
7,572 KB
testcase_11 AC 834 ms
7,340 KB
testcase_12 WA -
testcase_13 AC 849 ms
7,400 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 110 ms
7,332 KB
testcase_17 AC 604 ms
7,264 KB
testcase_18 AC 551 ms
7,344 KB
testcase_19 AC 83 ms
7,336 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 = 10000 * 10;
const int Max_ans = 10;

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