結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
fiord
|
| 提出日時 | 2015-07-09 23:36:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 708 bytes |
| コンパイル時間 | 1,322 ms |
| コンパイル使用メモリ | 166,832 KB |
| 実行使用メモリ | 13,760 KB |
| 最終ジャッジ日時 | 2024-07-08 01:51:03 |
| 合計ジャッジ時間 | 7,772 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 2 TLE * 1 -- * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:24: warning: integer overflow in expression of type ‘int’ results in ‘2147483647’ [-Woverflow]
12 | int ans=(1<<31)-1;
| ~~~~~~~^~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
vector<int> b(n);
vector<pair<int,int> > a(n);
for(int i=0;i<n;i++){
cin>>a[i].first; a[i].second=0;
}
for(int i=0;i<n;i++) cin>>b[i];
sort(a.begin(),a.end());
int ans=(1<<31)-1;
for(int s=0;s<n;s++){
int temp=0;
for(int i=s;i<n;i++){
cout<<a[0].first<<"to"<<b[i]<<endl;
a[0].first+=b[i]/2;
a[0].second++;
temp=max(temp,a[0].second);
sort(a.begin(),a.end());
}
for(int i=0;i<s;i++){
cout<<a[0].first<<"to"<<b[i]<<endl;
a[0].first+=b[i]/2;
a[0].second++;
temp=max(temp,a[0].second);
sort(a.begin(),a.end());
}
cout<<temp<<endl;
ans=min(ans,temp);
}
cout<<ans<<endl;
return 0;
}
fiord