結果
問題 | No.9 モンスターのレベル上げ |
ユーザー | legosuke |
提出日時 | 2019-01-12 03:58:16 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 302 ms / 5,000 ms |
コード長 | 1,493 bytes |
コンパイル時間 | 2,535 ms |
コンパイル使用メモリ | 170,872 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-08-21 07:36:13 |
合計ジャッジ時間 | 5,934 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,384 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 302 ms
4,376 KB |
testcase_03 | AC | 238 ms
4,384 KB |
testcase_04 | AC | 124 ms
4,376 KB |
testcase_05 | AC | 81 ms
4,376 KB |
testcase_06 | AC | 28 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | AC | 37 ms
4,376 KB |
testcase_09 | AC | 296 ms
4,380 KB |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | AC | 227 ms
4,380 KB |
testcase_12 | AC | 205 ms
4,376 KB |
testcase_13 | AC | 198 ms
4,380 KB |
testcase_14 | AC | 296 ms
4,380 KB |
testcase_15 | AC | 268 ms
4,380 KB |
testcase_16 | AC | 5 ms
4,380 KB |
testcase_17 | AC | 171 ms
4,380 KB |
testcase_18 | AC | 142 ms
4,380 KB |
testcase_19 | AC | 4 ms
4,380 KB |
ソースコード
#include <bits/stdc++.h> #define int long long #define uint unsigned int #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = (n); i >= 0; --i) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORR(i, a, b) for (int i = (a); i >= (b); --i) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define SZ(a) ((int)(a).size()) #define PB(a) push_back(a) #define EMP emplace #define EMPB(...) emplace_back(__VA_ARGS__) #define MP(a, b) make_pair(a, b) #define MT(...) make_tuple(__VA_ARGS__) #define Bit(n) (1LL << (n)) using namespace std; using pii = pair<int, int>; template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } const int MOD = 1000000007; const int INF = 1LL << 30; const double EPS = 1e-10; int N; int A[1510], B[1510]; int calc(int x) { priority_queue<pii, vector<pii>, greater<pii>> que; REP(i, N) que.EMP(A[i], 0); int r = 0; for (int i = x; ; i=(i+1)%N) { pii p = que.top(); que.pop(); que.EMP(p.first+B[i]/2, p.second+1); chmax(r, p.second+1); if ((i+1)%N == x) break; } return r; } signed main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); cin >> N; REP(i, N) cin >> A[i]; REP(i, N) cin >> B[i]; int ans = INF; REP(i, N) { chmin(ans, calc(i)); } cout << ans << endl; return 0; }