| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 169777 | Wilbur | 紧急集合 | C++ | Wrong Answer | 10 | 44 MS | 336 KB | 510 | 2024-08-20 17:03:15 |
#include <iostream> #include <algorithm> using namespace std; bool cmp(int a,int b){ return a>b; } int main() { long long n,a[100000],ans=0; cin>>n; for (int i = 0; i < n; i++){ cin>>a[i]; } sort(a,a+n,cmp); while (n!=1){ ans+=a[n-1]+a[n-2]; n--; long long c=n; while(ans>a[c-2]&&c-2>=0) { a[c-2]=a[c-1]; c--; } a[c-1]=a[n]+a[n-1]; } cout<<ans<<endl; return 0; }