結果
| 問題 |
No.2248 max(C)-min(C)
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2023-03-17 23:18:10 |
| 言語 | cLay (20241019-1) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 3,000 ms |
| コード長 | 345 bytes |
| コンパイル時間 | 2,740 ms |
| コンパイル使用メモリ | 177,204 KB |
| 実行使用メモリ | 8,576 KB |
| 最終ジャッジ日時 | 2024-09-18 12:21:56 |
| 合計ジャッジ時間 | 6,169 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
int@n,@a[n],@b[];
Heap<pair<int,pair<int,int>>>h;
h.malloc(n);
int mx=0;
rep(i,n){
int x=min(a[i],b[i]);
h.push({x,{abs(a[i]-b[i])>>1,2}});
mx>?=x;
}
int z=mx;
while(true){
auto c=h.pop();
z<?=mx-c.first;
if(c.second.second==0){
break;
}
int x=c.first+c.second.first;
h.push({x,{c.second.first,c.second.second-1}});
mx>?=x;
}
wt(z);
tails