結果

問題 No.9 モンスターのレベル上げ
ユーザー char134217728char134217728
提出日時 2017-08-19 04:00:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 402 ms / 5,000 ms
コード長 914 bytes
コンパイル時間 1,659 ms
コンパイル使用メモリ 151,980 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 05:34:34
合計ジャッジ時間 5,594 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 402 ms
4,380 KB
testcase_03 AC 322 ms
4,376 KB
testcase_04 AC 169 ms
4,376 KB
testcase_05 AC 109 ms
4,376 KB
testcase_06 AC 38 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 50 ms
4,376 KB
testcase_09 AC 392 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 323 ms
4,376 KB
testcase_12 AC 245 ms
4,376 KB
testcase_13 AC 187 ms
4,376 KB
testcase_14 AC 392 ms
4,376 KB
testcase_15 AC 357 ms
4,376 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 229 ms
4,376 KB
testcase_18 AC 192 ms
4,376 KB
testcase_19 AC 5 ms
4,380 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