提交记录 20006
提交时间 |
评测时间 |
2023-08-22 17:00:58 |
2023-08-22 17:01:03 |
#include<bits/stdc++.h>
using namespace std;
const int SIZE=1e5+3;
int d[SIZE],n,sum,tot,ans,not0,le;
inline int ask(int x)
{
return d[x]-le;
}
int main()
{
ios::sync_with_stdio(false);
cin>>n;
not0=n;
for(int i=1;i<=n;i++)
{
cin>>d[i];
if(d[i]==0) not0--;
sum+=d[i];
}
while(tot<sum)
{
int mi=0x3f3f3f3f;
bool yes=false;
int cnta=0;
not0=n;
for(int i=1;i<=n;i++)
{
// printf("Find Lastl=%d Lastr=%d || Nowl=%d Nowr=%d(YES?%d)\n",lastl,lastr,l,r,yes);
int idx=ask(i);
if(idx<=0)
{
not0--;
yes=false;
continue;
}
else
{
if(!yes) yes=true,cnta++;
mi=min(mi,idx);
}
}
le+=mi;
tot+=not0*mi;
ans+=mi*cnta;
}
cout<<ans;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 40.59 us | 68 KB | Accepted | Score: 10 | 显示更多 |
Testcase #2 | 43.26 us | 68 KB | Accepted | Score: 10 | 显示更多 |
Testcase #3 | 41.9 us | 68 KB | Accepted | Score: 10 | 显示更多 |
Testcase #4 | 42.63 us | 68 KB | Accepted | Score: 10 | 显示更多 |
Testcase #5 | 46.17 us | 68 KB | Accepted | Score: 10 | 显示更多 |
Testcase #6 | 115.6 us | 68 KB | Accepted | Score: 10 | 显示更多 |
Testcase #7 | 885.38 us | 76 KB | Accepted | Score: 10 | 显示更多 |
Testcase #8 | 21.613 ms | 112 KB | Accepted | Score: 10 | 显示更多 |
Testcase #9 | 1 s | 264 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
Testcase #10 | 1 s | 452 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2025-09-14 04:35:07 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠