結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
|
提出日時 | 2022-03-08 18:56:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 770 ms / 5,000 ms |
コード長 | 705 bytes |
コンパイル時間 | 4,507 ms |
コンパイル使用メモリ | 255,168 KB |
最終ジャッジ日時 | 2025-01-28 07:47:16 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#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(); }