結果
| 問題 | 
                            No.9 モンスターのレベル上げ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-03-29 02:02:22 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,089 bytes | 
| コンパイル時間 | 564 ms | 
| コンパイル使用メモリ | 64,876 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-29 09:37:52 | 
| 合計ジャッジ時間 | 4,508 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 20 | 
ソースコード
#include <climits>
#include <iostream>
#include <queue>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T MAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T MIN(T & a, const T b) { return a = (a > b) ? b : a; }
int main()
{
  INIT;
  int n; cin >> n;
  int an[n], bn[n];
  int ans = INT_MAX;
  priority_queue< int, vector<int>, greater<int> > q;
  REP(i, n) { cin >> an[i]; an[i] = an[i] << 12; }
  REP(i, n) { cin >> bn[i]; bn[i] = (bn[i] / 2) << 12; }
  REP(i, n) { cout << (bn[i] >> 12) << " "; }
  REP(p, n) {
    int times = 0;
    REP(i, n) { q.push(an[i]); }
    FOR(i, p, n) { int a = q.top() + bn[i] + 1; q.pop(); q.push(a); }
    FOR(i, 0, p) { int a = q.top() + bn[i] + 1; q.pop(); q.push(a); }
    while(!q.empty()) {
      times = MAX<int>(times, (q.top() & 0xFFF));
      q.pop();
    }
    ans = MIN<int>(times, ans);
  }
  cout << ans << "\n";
  return 0;
}