結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2015-11-21 20:34:14 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 449 ms / 5,000 ms |
コード長 | 1,846 bytes |
コンパイル時間 | 1,174 ms |
使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2023-01-21 15:24:14 |
合計ジャッジ時間 | 6,177 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,904 KB |
testcase_01 | AC | 2 ms
6,948 KB |
testcase_02 | AC | 449 ms
4,904 KB |
testcase_03 | AC | 358 ms
6,948 KB |
testcase_04 | AC | 188 ms
4,904 KB |
testcase_05 | AC | 123 ms
4,900 KB |
testcase_06 | AC | 41 ms
4,904 KB |
testcase_07 | AC | 2 ms
4,900 KB |
testcase_08 | AC | 56 ms
6,948 KB |
testcase_09 | AC | 436 ms
4,904 KB |
testcase_10 | AC | 2 ms
4,904 KB |
testcase_11 | AC | 379 ms
4,904 KB |
testcase_12 | AC | 296 ms
4,900 KB |
testcase_13 | AC | 207 ms
4,900 KB |
testcase_14 | AC | 438 ms
4,904 KB |
testcase_15 | AC | 399 ms
4,904 KB |
testcase_16 | AC | 7 ms
4,904 KB |
testcase_17 | AC | 255 ms
6,948 KB |
testcase_18 | AC | 214 ms
4,900 KB |
testcase_19 | AC | 4 ms
4,900 KB |
ソースコード
#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" #define aLL(g) (g).begin(),(g).end() #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define F(i,j,k) fill(i[0],i[0]+j*j,k) #define P(p) cout<<(p)<<endl; #define EXISt(s,e) ((s).find(e)!=(s).end()) #define INF 1<<25 #define MAX 100000000 #define pb push_back #define mp make_pair using namespace std; typedef vector<int> vi; typedef vector<long long> vl; typedef vector<double> vd; typedef pair<int, int> pii; typedef pair<long, long> pll; typedef pair<pair<int, int>, int> pp; typedef long long ll; int dx[] = { 0, 1, 0, -1 }; int dy[] = { -1, 0, 1, 0 }; int sttoi(std::string str) { int ret; std::stringstream ss; ss << str; ss >> ret; return ret; } bool sort_greater(const pair<string, int> &a, const pair<string, int> &b) { return a.second > b.second; } int gcd(int a, int b){ if (b > a)swap(a, b);if (b == 0)return a;else{return gcd(b, a%b);} } void solve() { int n; cin >> n; vector<int> me; vector<int> enemy; rep(i, n){ int a; cin >> a; me.push_back(a); } rep(i, n){ int a; cin >> a; enemy.push_back(a); } int maxi = -1; int mini = 10000000; rep(i, enemy.size()){ priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > copy; rep(j, me.size()){ copy.push(make_pair(me[j], 0)); } REP(j, i, enemy.size()){ pair<int, int> p = copy.top(); copy.pop(); int e = enemy[j]; copy.push(make_pair(p.first + (e / 2), p.second + 1)); } REP(j, 0, i){ pair<int, int> p = copy.top(); copy.pop(); int e = enemy[j]; copy.push(make_pair(p.first + (e / 2), p.second + 1)); } maxi = -1; while (!copy.empty()){ pair<int, int> p = copy.top(); copy.pop(); maxi = max(maxi, p.second); } mini = min(mini, maxi); } P(mini); } int main() { solve(); return 0; }