結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2020-03-28 18:00:33 |
言語 | C++14 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 518 ms / 5,000 ms |
コード長 | 1,390 bytes |
コンパイル時間 | 1,528 ms |
使用メモリ | 3,632 KB |
最終ジャッジ日時 | 2023-01-17 13:20:27 |
合計ジャッジ時間 | 7,232 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
3,392 KB |
testcase_01 | AC | 2 ms
3,488 KB |
testcase_02 | AC | 518 ms
3,472 KB |
testcase_03 | AC | 409 ms
3,536 KB |
testcase_04 | AC | 216 ms
3,548 KB |
testcase_05 | AC | 140 ms
3,452 KB |
testcase_06 | AC | 47 ms
3,416 KB |
testcase_07 | AC | 2 ms
3,512 KB |
testcase_08 | AC | 63 ms
3,612 KB |
testcase_09 | AC | 501 ms
3,576 KB |
testcase_10 | AC | 2 ms
3,388 KB |
testcase_11 | AC | 451 ms
3,628 KB |
testcase_12 | AC | 365 ms
3,468 KB |
testcase_13 | AC | 251 ms
3,544 KB |
testcase_14 | AC | 503 ms
3,632 KB |
testcase_15 | AC | 459 ms
3,584 KB |
testcase_16 | AC | 9 ms
3,504 KB |
testcase_17 | AC | 294 ms
3,464 KB |
testcase_18 | AC | 246 ms
3,468 KB |
testcase_19 | AC | 5 ms
3,512 KB |
ソースコード
#include <bits/stdc++.h> #define int long long #define REP(i, b) for(int i = 0; i < (b); i++) #define REPS(i, b) for(int i = 1; i <= (b); i++) #define ALL(v) (v).begin(), (v).end() #define fi first #define se second #define pb push_back #define mp make_pair using namespace std; using pi = pair<int, int>; using vi = vector<int>; using vs = vector<string>; using vb = vector<bool>; using vpi = vector<pi>; using vvi = vector<vi>; using vvb = vector<vb>; const int INF = 1e16; const int MOD = 1e9+7; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } signed main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); int N; cin >> N; vi A(N), B(N); REP(i, N) cin >> A[i]; REP(i, N) cin >> B[i], B[i] /= 2; int ans = INF; REP(i, N) { priority_queue<pi, vpi, greater<>> q; REP(j, N) q.push(mp(A[j], 0)); REP(j, N) { pi p = q.top(); q.pop(); p.fi += B[(i+j)%N]; p.se++; q.push(p); } int t = 0; while(!q.empty()) { pi p = q.top(); q.pop(); chmax(t, p.se); } chmin(ans, t); } cout << ans << endl; }