結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
|
提出日時 | 2019-01-12 03:58:16 |
言語 | C++14 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 293 ms / 5,000 ms |
コード長 | 1,493 bytes |
コンパイル時間 | 1,451 ms |
使用メモリ | 3,632 KB |
最終ジャッジ日時 | 2023-01-07 17:33:45 |
合計ジャッジ時間 | 5,974 ms |
ジャッジサーバーID (参考情報) |
judge16 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
3,472 KB |
testcase_01 | AC | 1 ms
3,412 KB |
testcase_02 | AC | 293 ms
3,428 KB |
testcase_03 | AC | 231 ms
3,476 KB |
testcase_04 | AC | 122 ms
3,444 KB |
testcase_05 | AC | 79 ms
3,384 KB |
testcase_06 | AC | 27 ms
3,528 KB |
testcase_07 | AC | 2 ms
3,356 KB |
testcase_08 | AC | 36 ms
3,560 KB |
testcase_09 | AC | 286 ms
3,592 KB |
testcase_10 | AC | 2 ms
3,440 KB |
testcase_11 | AC | 242 ms
3,476 KB |
testcase_12 | AC | 184 ms
3,520 KB |
testcase_13 | AC | 157 ms
3,632 KB |
testcase_14 | AC | 287 ms
3,608 KB |
testcase_15 | AC | 259 ms
3,488 KB |
testcase_16 | AC | 6 ms
3,480 KB |
testcase_17 | AC | 167 ms
3,480 KB |
testcase_18 | AC | 139 ms
3,576 KB |
testcase_19 | AC | 3 ms
3,408 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; }