| 题目名称 | 2617. 新人求助,本机AC提交TLE |
|---|---|
| 输入输出 | newworld.in/out |
| 难度等级 | ★★☆ |
| 时间限制 | 1000 ms (1 s) |
| 内存限制 | 128 MiB |
| 测试数据 | 10 |
| 题目来源 |
|
| 开放分组 | 全部用户 |
| 提交状态 | |
| 分类标签 | |
| 分享题解 |
| 通过:1, 提交:6, 通过率:16.67% | ||||
|
|
100 | 0.277 s | 0.88 MiB | C++ |
|
|
10 | 5.798 s | 0.95 MiB | C++ |
|
|
10 | 5.812 s | 1.08 MiB | C++ |
|
|
10 | 5.817 s | 0.95 MiB | C++ |
|
|
10 | 5.956 s | 1.06 MiB | C++ |
|
|
10 | 6.047 s | 1.83 MiB | C++ |
| 关于 新人求助,本机AC提交TLE 的近10条评论(全部评论) | ||||
|---|---|---|---|---|
|
吐槽一下:为什么这样一道模板题大家都要去交暴力??(You must be kidding?)
2017-02-28 07:38
9楼
| ||||
|
这只是一个简单题,idea来自“未来程序”。
梗来自某ZOJ的Discuss
2017-02-26 18:58
8楼
| ||||
|
新人求助,A+B那题,本机TLE提交AC。。。
#include <cstdio> int a, b; int main(){ scanf("%d%d", &a, &b); for (int i = 1000000000;i; i-- ) a--, b++; printf("%d\n", a + b); return 0; }
2017-02-24 18:36
7楼
| ||||
|
两次[size=55]1A[/size]
2017-02-24 18:28
6楼
| ||||
|
[size=50]1A[/size]
2017-02-24 18:26
5楼
| ||||
|
回复 @Ezoi_HelenKeller :
这代码明显有问题,你本地是怎么TLE的?
2017-02-24 18:24
4楼
| ||||
|
好丑
2017-02-24 16:35
3楼
| ||||
|
吐槽一下puts("9");while(true);
他给我的数据我本机测是TLE的啊,为什么叫上去还是TLE呢?不是说COGS评测姬很快的吗?
2017-02-24 16:33
2楼
| ||||
|
你做数据了吗就TLE 告诉你这题要开栈 你RE了
2017-02-24 16:31
1楼
| ||||
新人求助,本机AC提交又WA又TLE。。。
下面是我的代码:
#include<cstdio>
const int maxn=1005,maxm=50005,INF=0x3f3f3f3f;
struct tree{int to,next,num;}e[maxm];
int n,m,len,head[maxn],Dis[maxm],S,cnt;bool vis[maxn];
void set(int prt,int son,int num){
e[++len].to=son,e[len].next=head[prt],head[prt]=len,e[len].num=num;
}
void dfs(int rt){
vis[rt]=true,cnt++;
for(int i=head[rt];i;i=e[i].next)
if((S&(1<<e[i].num))&&!vis[e[i].to])dfs(e[i].to);
}
int main(){
freopen("newworld.in","r",stdin);
freopen("newworld.out","w",stdout);
scanf("%d%d",&n,&m);int i,j,x,y,N=1<<m,ans=INF,tmp;
for(i=0;i<m;i++)scanf("%d%d%d",&x,&y,&Dis[i]),set(x,y,i);
for(i=0;i<N;i++){
S=i;cnt=0;for(j=1;j<=n;j++)vis[j]=false;
dfs(1);if(cnt<n)continue;
tmp=0;
for(j=0;j<m;j++)if(S&(1<<j))tmp+=Dis[j];
if(tmp<ans)ans=tmp;
}
printf("%d\n",ans);
return 0;
}
5 10
1 4 2
4 3 6
3 5 1
5 2 0
1 1 3
2 3 8
1 4 2
2 1 0
5 1 8
5 5 5
9
数据范围
对于10%的数据n<=20,m<=20
对于30%的数据n<=100,m<=2000
另有20%的数据m<=n
另有20%的数据输入的Dis[]的值<=100
对于100%的数据n<=1000,m<=50000,所有读入的数字<=1000000;
一只名字很长的蒟蒻