結果

問題 No.9 モンスターのレベル上げ
ユーザー mukadenodaioumukadenodaiou
提出日時 2018-03-28 16:25:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,375 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 99,972 KB
最終ジャッジ日時 2024-04-27 02:32:38
合計ジャッジ時間 1,297 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp:25:21: error: 'numeric_limits' is not a member of 'std'
   25 | const ll INF = std::numeric_limits<long long>::max();
      |                     ^~~~~~~~~~~~~~
main.cpp:25:36: error: expected primary-expression before 'long'
   25 | const ll INF = std::numeric_limits<long long>::max();
      |                                    ^~~~

ソースコード

diff #

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const ll mod = 1000000007;
const ll INF = std::numeric_limits<long long>::max();
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define srep(i,s) rep(i,(ll)s.size())
#define vin(n,v) rep(i,n)cin>>v[i]
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define fi first
#define se second
#define sz size()
void YN(bool b) { cout << (b ? "YES" : "NO") << endl; }
void yn(bool b) { cout << (b ? "Yes" : "No") << endl; }
ll n, b[1510], aa[1510], mn = INF;
priority_queue<pp,vector<pp>,greater<pp>>q;
int main(){
	cin >> n;
	pp p; p.se = 0;
	rep(i, n) { cin >> p.fi; aa[i] = p.fi; q.push(p); }
	rep(i, n)cin >> b[i];
	rep(st, n) {
		rep(i, n) {
			pp a = q.top(); q.pop();
			a.fi += b[(i + st) % n] / 2;
			a.se++;
			q.push(a);
		}
		priority_queue<ll>q2;
		rep(i, n) {
			pp a = q.top(); q.pop();
			q2.push(a.se);
		}
		mn = min(q2.top(),mn);
		rep(i, n) {q.push(pp{ aa[i],0 }); }
	}
	cout << mn << endl;
	return 0;
}
0