結果

問題 No.9 モンスターのレベル上げ
ユーザー myantamyanta
提出日時 2017-04-30 20:45:35
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 840 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 53,048 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-11 23:58:09
合計ジャッジ時間 4,347 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>


using namespace std;


struct p_t
{
	int l, x;
	bool operator<(const p_t& rhs) const
	{
		if(l!=rhs.l) return (l>rhs.l);
		return (x>rhs.x);
	}
};


int max_u(int& m, int v)
{
	if(m<v)
	{
		m=v;
		return 1;
	}
	return 0;
}


int main(void)
{
	int n, i, j;
	vector<int> a;
	vector<int> b;
	int max;

	while(scanf("%d", &n)==1)
	{
		a.resize(n);
		b.resize(n);
		for(i=0;i<n;i++)
		{
			scanf("%d", &a[i]);
		}
		for(i=0;i<n;i++)
		{
			scanf("%d", &b[i]);
			b[i]/=2;
		}

		max=0;
		for(i=0;i<n;i++)
		{
			priority_queue<p_t, vector<p_t> > q;
			p_t p;
			for(j=0;j<n;j++) q.push((p_t){a[j], 0});
			for(j=0;j<n;j++)
			{
				p=q.top();
				q.pop();
				p.l+=b[(i+j)%n];
				p.x++;
				q.push(p);
				max_u(max, p.x);
			}
		}
		printf("%d\n", max);
	}

	return 0;
}
0