- 接水问题
- 2016-09-23 21:49:18 @
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,people[10010]={0},water[110]={0};
long long t=0;
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)
cin>>people[i];
people[0]=1;
while(1)
{
for(int i=1;i<=m;i++)
{
if(water[i]==0)
{water[i]=people[people[0]];people[0]++;}
}
for(int i=1;i<=m;i++)
water[i]--;
t++;
bool T=true;
for(int i=1;i<=m;i++)
if(water[i])
T=false;
if(T==true && people[0]>n)
break;
}
cout<<t;
return 0;
}
编译成功
测试数据 #0: TimeLimitExceeded, time = 1015 ms, mem = 592 KiB, score = 0
测试数据 #1: TimeLimitExceeded, time = 1203 ms, mem = 592 KiB, score = 0
测试数据 #2: TimeLimitExceeded, time = 1203 ms, mem = 592 KiB, score = 0
测试数据 #3: TimeLimitExceeded, time = 1203 ms, mem = 592 KiB, score = 0
测试数据 #4: TimeLimitExceeded, time = 1015 ms, mem = 592 KiB, score = 0
测试数据 #5: TimeLimitExceeded, time = 1015 ms, mem = 592 KiB, score = 0
测试数据 #6: TimeLimitExceeded, time = 1015 ms, mem = 596 KiB, score = 0
测试数据 #7: TimeLimitExceeded, time = 1015 ms, mem = 592 KiB, score = 0
测试数据 #8: Accepted, time = 0 ms, mem = 604 KiB, score = 10
测试数据 #9: TimeLimitExceeded, time = 1015 ms, mem = 592 KiB, score = 0
TimeLimitExceeded, time = 9699 ms, mem = 604 KiB, score = 10
1 条评论
-
BIRDlhf LV 8 @ 2016-09-25 20:34:50
前排强势违观
- 1
信息
- ID
- 1811
- 难度
- 4
- 分类
- (无)
- 标签
- 递交数
- 1852
- 已通过
- 785
- 通过率
- 42%
- 被复制
- 15
- 上传者