| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 135367 | 吴松韬 | 紧急集合 | C++ | Runtime Error | 0 | 1 MS | 404 KB | 490 | 2024-03-05 13:38:24 |
#include<bits/stdc++.h> using namespace std; int n,sum,ans; int a[10001],b[10001],t[20000]; int main(){ scanf("%d",&n); memset(a,127,sizeof(a)); memset(b,127,sizeof(b)); for(int i=1,k;i<n;i++){ scanf("%d",&k); t[k]++; } for(int i=1,k=0;i<=20000;i++){ for(;t[i];t[i]--){ a[++k]=i; } } int k1=1,k2=1; for(int i=1,k=0;i<n;i++){ sum=a[k1]<b[k2]?a[k1++]:b[k2++]; sum+=a[k1]<b[k2]?a[k1++]:b[k2++]; b[++k]=sum; ans+=sum; } printf("%d",ans); }