結果

問題 No.9 モンスターのレベル上げ
ユーザー char134217728char134217728
提出日時 2017-08-19 04:00:31
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 403 ms / 5,000 ms
コード長 914 bytes
コンパイル時間 1,586 ms
使用メモリ 3,608 KB
最終ジャッジ日時 2023-01-21 16:52:30
合計ジャッジ時間 6,059 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,496 KB
testcase_01 AC 2 ms
3,548 KB
testcase_02 AC 403 ms
3,500 KB
testcase_03 AC 322 ms
3,500 KB
testcase_04 AC 169 ms
3,560 KB
testcase_05 AC 110 ms
3,496 KB
testcase_06 AC 38 ms
3,596 KB
testcase_07 AC 2 ms
3,504 KB
testcase_08 AC 50 ms
3,480 KB
testcase_09 AC 392 ms
3,436 KB
testcase_10 AC 2 ms
3,396 KB
testcase_11 AC 324 ms
3,580 KB
testcase_12 AC 246 ms
3,604 KB
testcase_13 AC 188 ms
3,528 KB
testcase_14 AC 392 ms
3,608 KB
testcase_15 AC 358 ms
3,432 KB
testcase_16 AC 8 ms
3,556 KB
testcase_17 AC 228 ms
3,608 KB
testcase_18 AC 192 ms
3,500 KB
testcase_19 AC 5 ms
3,512 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:16:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main(){
      ^

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
const int inf = 1e9;
const int mod = 1e9+7;

typedef priority_queue<pii, vector<pii>, greater<pii> > pq;
pq qf, q;
int m[1500];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  FOR(i, 0, n){
    int a;
    cin >> a;
    qf.push(pii(a, 0));
  }
  FOR(i, 0, n){
    int a;
    cin >> a;
    m[i] = a/2;
  }
  int ans = inf;
  FOR(i, 0, n){
    q = qf;
    FOR(j, 0, n){
      pii tmp = q.top();
      q.pop();
      tmp.first += m[(i + j) % n];
      tmp.second++;
      q.push(tmp);
    }
    int m = -1;
    while(!q.empty()){
      pii tmp = q.top();
      m = max(m, tmp.second);
      q.pop();
    }
    ans = min(ans, m);
  }
  cout << ans << endl;
}
0