結果
問題 |
No.2078 魔抜けなパープル
|
ユーザー |
![]() |
提出日時 | 2022-10-06 22:31:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 596 bytes |
コンパイル時間 | 1,609 ms |
コンパイル使用メモリ | 174,540 KB |
実行使用メモリ | 6,416 KB |
最終ジャッジ日時 | 2024-06-11 09:12:31 |
合計ジャッジ時間 | 3,410 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | WA * 4 RE * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int q; cin>>q; while(q--){ int x,a; cin>>x>>a; vector<pair<double,ll>> tank(a); for(int i=0;i<a;i++){ tank[i]={(double)(i+1)+(double)x/(i+1),(ll)i+1}; } sort(tank.rbegin(),tank.rend()); int pos=a-1; ll mp=0; while(a){ while(a<tank[pos].second&&pos>=0)pos--; a-=tank[pos].second; mp+=(tank[pos].second)*(tank[pos].second)+x; pos--; } cout<<mp<<endl; } }