結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2018-06-13 16:02:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 449 ms / 5,000 ms |
コード長 | 867 bytes |
コンパイル時間 | 1,731 ms |
コンパイル使用メモリ | 174,756 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 14:07:28 |
合計ジャッジ時間 | 6,337 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 8 | main(){ | ^~~~
ソースコード
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=int(a);i<int(b);++i) using namespace std; typedef long long ll; typedef pair<int,int> P; int INF = (1LL << 30) - 1; int MOD = 1e9+7; main(){ int N; cin >> N; vector<int> A(N),B(N); rep(i,0,N)cin >> A[i]; rep(i,0,N)cin >> B[i]; int mini = INF; rep(i,0,N){ priority_queue< P, vector< P >, greater< P > > que; rep(j,0,N)que.push( P(A[j], 0) ); rep(j,0,N){ //next = (i + j) % N P p = que.top(); que.pop(); p.first += B[(i + j) % N] / 2; p.second ++; que.push(p); } int maxi = 0; while(!que.empty()){ P p = que.top(); que.pop(); maxi = max(maxi, p.second); } mini = min(mini, maxi); } cout << mini << endl; }