結果

問題 No.9 モンスターのレベル上げ
ユーザー ttkkggwwttkkggww
提出日時 2022-03-08 18:56:46
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 759 ms / 5,000 ms
コード長 705 bytes
コンパイル時間 4,408 ms
コンパイル使用メモリ 263,712 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-10-01 01:25:53
合計ジャッジ時間 11,472 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 759 ms
4,380 KB
testcase_03 AC 595 ms
4,376 KB
testcase_04 AC 312 ms
4,376 KB
testcase_05 AC 204 ms
4,376 KB
testcase_06 AC 69 ms
4,380 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 92 ms
4,376 KB
testcase_09 AC 730 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 461 ms
4,376 KB
testcase_12 AC 274 ms
4,384 KB
testcase_13 AC 398 ms
4,384 KB
testcase_14 AC 735 ms
4,376 KB
testcase_15 AC 670 ms
4,380 KB
testcase_16 AC 11 ms
4,380 KB
testcase_17 AC 425 ms
4,376 KB
testcase_18 AC 355 ms
4,380 KB
testcase_19 AC 7 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
int n;
vector<int> a,b;
using P = pair<int,int>;

void solve(){
	int out = n;
	for(int i = 0;i<n;i++){
		multiset<P> mst;
		for(auto &j:a)mst.emplace(j,0);
		for(int j = 0;j<n;j++){
			auto it = mst.begin();
			auto p = *it;
			mst.erase(it);
			p.second++;
			p.first += b[(i+j)%n]/2;
			mst.insert(p);
		}
		int ans = 0;
		for(auto &j:mst)ans = max(ans,j.second);
		out = min(ans,out);
	}
	cout<<out<<endl;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> n;
	a = vector<int>(n);
	b = vector<int>(n);
	for(auto &i:a)cin >> i;
	for(auto &i:b)cin >> i;
	solve();
}
0