結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2015-03-20 21:49:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 215 ms / 5,000 ms |
コード長 | 1,136 bytes |
コンパイル時間 | 1,037 ms |
コンパイル使用メモリ | 87,160 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 22:33:25 |
合計ジャッジ時間 | 3,593 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:28:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:33:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 33 | scanf("%d", &a); | ~~~~~^~~~~~~~~~ main.cpp:38:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 38 | scanf("%d", &b); | ~~~~~^~~~~~~~~~
ソースコード
#include <algorithm> #include <iostream> #include <cstdio> #include <map> #include <numeric> #include <cmath> #include <set> #include <sstream> #include <string> #include <vector> #include <queue> #include <complex> #include <string.h> using namespace std; #define endl '\n' #define all(v) (v).begin(), (v).end() #define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end()) typedef long long ll; typedef pair<int, int> P; typedef unsigned int uint; const int inf = 1000000009; int main() { int n; scanf("%d", &n); priority_queue<P, vector<P>, greater<P> > t_que; vector<int> bs(2*n); for (int i = 0; i < n; i++) { int a; scanf("%d", &a); t_que.push(P(a, 0)); } for (int i = 0; i < n; i++) { int b; scanf("%d", &b); bs[i] = bs[i+n] = b; } int res = inf; for (int i = 0; i < n; i++) { priority_queue<P, vector<P>, greater<P> > que = t_que; int maxi = 0; for (int j = i; j < i + n; j++) { P p = que.top(); que.pop(); p.first += bs[j]/2; p.second++; maxi = max(maxi, p.second); que.push(p); } res = min(res, maxi); } printf("%d\n", res); }