結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
nanophoto12
|
| 提出日時 | 2016-02-17 01:05:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,862 bytes |
| コンパイル時間 | 965 ms |
| コンパイル使用メモリ | 94,292 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 07:23:13 |
| 合計ジャッジ時間 | 3,653 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 4 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <functional>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
class CompareDist
{
public:
bool operator()(pair<int,int> n1,pair<int,int> n2) {
return n1.first>n2.first;
}
};
int main()
{
int n;
cin >> n;
vector<int> a(n);
FOR(x, n)
{
cin >> a[x];
}
vector<int> b(n);
FOR(x, n)
{
cin >> b[x];
}
priority_queue<pair<int,int>, vector<pair<int,int>>,CompareDist> source;
FOR(y, n)
{
source.push(make_pair(a[y], 0));
}
int minValue = 1000000000;
FOR(s, n)
{
int maxValue = 0;
priority_queue<pair<int,int>, vector<pair<int,int>>,CompareDist> copy = source;
FOR(x, n)
{
int index = (s + x) % n;
auto top = copy.top();
copy.pop();
auto next = make_pair(top.first + b[index]/2, top.second+1);
maxValue = max(maxValue, next.second);
copy.push(next);
}
//cout << s << "," << maxValue << endl;
if(minValue > maxValue)
{
minValue = maxValue;
}
}
cout << minValue << endl;
return 0;
}
nanophoto12