結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2018-03-01 10:05:06 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 189 ms / 5,000 ms |
コード長 | 1,511 bytes |
コンパイル時間 | 479 ms |
使用メモリ | 3,616 KB |
最終ジャッジ日時 | 2023-01-21 17:05:07 |
合計ジャッジ時間 | 3,349 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
3,532 KB |
testcase_01 | AC | 2 ms
3,484 KB |
testcase_02 | AC | 189 ms
3,596 KB |
testcase_03 | AC | 150 ms
3,540 KB |
testcase_04 | AC | 76 ms
3,480 KB |
testcase_05 | AC | 54 ms
3,508 KB |
testcase_06 | AC | 19 ms
3,392 KB |
testcase_07 | AC | 2 ms
3,452 KB |
testcase_08 | AC | 24 ms
3,528 KB |
testcase_09 | AC | 186 ms
3,440 KB |
testcase_10 | AC | 1 ms
3,444 KB |
testcase_11 | AC | 134 ms
3,536 KB |
testcase_12 | AC | 166 ms
3,440 KB |
testcase_13 | AC | 134 ms
3,588 KB |
testcase_14 | AC | 186 ms
3,596 KB |
testcase_15 | AC | 169 ms
3,584 KB |
testcase_16 | AC | 4 ms
3,452 KB |
testcase_17 | AC | 107 ms
3,616 KB |
testcase_18 | AC | 87 ms
3,500 KB |
testcase_19 | AC | 3 ms
3,536 KB |
ソースコード
#include <iostream> #include <vector> #include <map> #include <queue> using namespace std; struct Struct{ int count,level; bool operator<(const Struct &other)const{ if(level==other.level) return count>other.count; else return level>other.level; } }; int main(){ int N; cin >>N; vector <int>b; vector <Struct> a; priority_queue <Struct> aaa; for(int i=0 ; i<N ; i++ ){ Struct x;cin >> x.level; x.count=0; a.push_back(x); aaa.push(x); }for(int i=0 ; i<N ; i++ ){ int x;cin >> x; b.push_back(x/2); } int Max=2000000000; for(int i=0 ; i<N ; i++ ){ priority_queue<Struct> now=aaa; int counter=0,tmax=0; while(counter!=N){ int l=(i+counter)%N; Struct next; next.level=now.top().level+b[l]; next.count=now.top().count+1; now.pop(); now.push(next); counter++; if(tmax<next.count)tmax=next.count; // if(Max<=tmax)break; } //:w cout << tmax << " "<<i << endl; if(Max>tmax)Max=tmax; } cout <<Max<<endl; return 0; }