結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2015-02-17 23:58:36 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 256 ms / 5,000 ms |
コード長 | 1,484 bytes |
コンパイル時間 | 895 ms |
使用メモリ | 3,652 KB |
最終ジャッジ日時 | 2023-01-21 14:16:45 |
合計ジャッジ時間 | 4,104 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
3,436 KB |
testcase_01 | AC | 2 ms
3,436 KB |
testcase_02 | AC | 256 ms
3,640 KB |
testcase_03 | AC | 203 ms
3,492 KB |
testcase_04 | AC | 101 ms
3,528 KB |
testcase_05 | AC | 69 ms
3,624 KB |
testcase_06 | AC | 24 ms
3,452 KB |
testcase_07 | AC | 2 ms
3,448 KB |
testcase_08 | AC | 31 ms
3,588 KB |
testcase_09 | AC | 251 ms
3,492 KB |
testcase_10 | AC | 1 ms
3,440 KB |
testcase_11 | AC | 208 ms
3,496 KB |
testcase_12 | AC | 247 ms
3,564 KB |
testcase_13 | AC | 165 ms
3,652 KB |
testcase_14 | AC | 253 ms
3,564 KB |
testcase_15 | AC | 229 ms
3,620 KB |
testcase_16 | AC | 5 ms
3,544 KB |
testcase_17 | AC | 142 ms
3,552 KB |
testcase_18 | AC | 116 ms
3,588 KB |
testcase_19 | AC | 3 ms
3,512 KB |
ソースコード
#include<iostream> #include<sstream> #include<cstdio> #include<cstring> #include<algorithm> #include<string> #include<vector> #include<cmath> #include<set> #include<map> #include<stack> #include<queue> #include<numeric> #include<functional> #include<complex> using namespace std; #define BET(a,b,c) ((a)<=(b)&&(b)<(c)) #define FOR(i,n) for(int i=0,i##_end=(int(n));i<i##_end;i++) #define SZ(x) (int)(x.size()) #define ALL(x) (x).begin(),(x).end() #define MP make_pair #define FOR_EACH(it,v) for(__typeof(v.begin()) it=v.begin(),it_end=v.end() ; it != it_end ; it++) typedef vector<int> VI; typedef vector<VI> VVI; struct monster{ int index; int level; int attack; friend bool operator<(const monster&m1, const monster&m2){ if(m1.level != m2.level) return m1.level > m2.level; return m1.attack > m2.attack; } }; int main() { int N; cin>>N; VI A(N), B(N); FOR(i,N) scanf("%d",&A[i]); FOR(i,N) scanf("%d",&B[i]); int ans = 1<<28; FOR(start,N){ priority_queue<monster> qu; FOR(i,N) { qu.push((monster){ i, A[i], 0 }); } int maxAttack = 0; FOR(i,N){ int targetLevel = B[(start + i) % N]; monster m = qu.top(); qu.pop(); m.level += targetLevel / 2; m.attack++; maxAttack = max(maxAttack, m.attack); qu.push(m); } ans = min(ans, maxAttack); } cout<<ans<<endl; return 0; }