結果

問題 No.9 モンスターのレベル上げ
ユーザー penqenpenqen
提出日時 2021-03-29 02:01:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,087 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 66,396 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-19 16:00:03
合計ジャッジ時間 4,453 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
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 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0