結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
spade630
|
| 提出日時 | 2015-10-18 00:33:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 465 ms / 5,000 ms |
| コード長 | 1,263 bytes |
| コンパイル時間 | 868 ms |
| コンパイル使用メモリ | 79,044 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 23:13:33 |
| 合計ジャッジ時間 | 5,575 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:41:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
41 | scanf("%d", &a);
| ~~~~~^~~~~~~~~~
main.cpp:45:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
45 | scanf("%d", &b[i]);
| ~~~~~^~~~~~~~~~~~~
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <time.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FFOR(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
#define RREP(i,b) FFOR(i,1,b)
#define PB push_back
#define F first
#define S second
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef int ut;
typedef long double ld;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef vector<ut> VI;
typedef pair<ut,pr> ppr;
typedef priority_queue<pr,Vpr, greater<pr> > PQ;
const int SIZE=1e+5 + 1;
const ut INF=1<<30;
const ld eps=1e-6;
const LL mod=1e+9 + 7;
int main() {
int n;
cin >> n;
int a, b[2048];
PQ base;
REP(i,n){
scanf("%d", &a);
base.push(pr(a, 0));
}
REP(i,n){
scanf("%d", &b[i]);
}
int ans = INF;
REP(i,n){
PQ que = base;
int now = i;
for(int j = 0; j < n; ++j, now++){
if(now >= n)
now -= n;
pr p = que.top(); que.pop();
que.push(pr(p.F + b[now] / 2, p.S + 1));
}
int res = 0;
while(!que.empty()){
pr p = que.top(); que.pop();
res = max(res, p.S);
}
ans = min(ans, res);
}
cout << ans << endl;
return 0;
}
spade630