結果

問題 No.9 モンスターのレベル上げ
ユーザー 158b158b
提出日時 2015-05-14 16:24:58
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,419 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 63,836 KB
実行使用メモリ 31,300 KB
最終ジャッジ日時 2023-09-20 07:46:10
合計ジャッジ時間 34,324 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
27,004 KB
testcase_01 AC 24 ms
26,788 KB
testcase_02 TLE -
testcase_03 AC 4,542 ms
26,824 KB
testcase_04 AC 3,379 ms
26,888 KB
testcase_05 AC 2,811 ms
26,824 KB
testcase_06 AC 1,700 ms
26,920 KB
testcase_07 AC 255 ms
26,844 KB
testcase_08 AC 2,068 ms
26,968 KB
testcase_09 TLE -
testcase_10 AC 11 ms
26,820 KB
testcase_11 TLE -
testcase_12 WA -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 738 ms
26,876 KB
testcase_17 AC 4,201 ms
26,816 KB
testcase_18 AC 3,853 ms
26,824 KB
testcase_19 AC 577 ms
27,144 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 = 60;

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