結果
| 問題 |
No.9 モンスターのレベル上げ
|
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-07-16 00:15:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 207 ms / 5,000 ms |
| コード長 | 1,122 bytes |
| コンパイル時間 | 966 ms |
| コンパイル使用メモリ | 79,640 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 22:44:09 |
| 合計ジャッジ時間 | 3,273 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:30:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
30 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:33:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
33 | scanf("%d",&A[i]);
| ~~~~~^~~~~~~~~~~~
main.cpp:39:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
39 | scanf("%d",&B[i]);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
typedef long long ll;
using namespace std;
#define mod 1000000007
#define INF 1000000000
#define LLINF 2000000000000000000LL
#define SIZE 10000
int main(){
int n,ans=INF;
int A[SIZE],B[SIZE];
priority_queue<pair<int,int> > st;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&A[i]);
st.push(make_pair(-A[i],0));
}
for(int i=0;i<n;i++)
scanf("%d",&B[i]);
for(int i=0;i<n;i++){
priority_queue<pair<int,int> > pq =st;
int cc=0;
for(int j=0;j<n;j++){
pair<int,int> p = pq.top();
pq.pop();
p.second--;
p.first-=B[(i+j)%n]/2;
cc = max(cc,-p.second);
pq.push(p);
}
ans = min(ans,cc);
}
cout << ans << endl;
return 0;
}
goodbaton