F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_33234336_6336.cpp:2:1: error: expected declaration before '}' token
 };// 输出 false 的时候 a 排在前面 bool operator < (node a, node b) { return a.u > b.u; }// n 是节点总数,约定节点从 1 开始排。 void toposort(int n) { priority_queue<node> q; // 遍历图上所有节点,把出度为 0 的节点加入队列。 for(int i=0 ; i<=n ; ++i) ans[i] = 0; for(int i=1 ; i<=n ; ++i) { if(ind[i]==0) { q.push(i); } }while(!q.empty()) { int u=q.top().u; q.pop(); ans[++ans[0]] = u; // 从队列里面拿出来的节点,放入拓扑排序序 列。 for(int i=head[u]; i; i=e[i].next) { int v=e[i].v; --ind[v]; if(ind[v]==0) q.push(v); } } }int main() { int n,m; while(~scanf("%d%d",&n,&m)) { if(n==0) break; // 清空计算空间。 memset(head,0,sizeof(head)); totp=0; for(int i=0; i<=n; ++i) ind[i]=0; for(int i=1; i<=m; ++i) { int u,v; scanf("%d%d",&u,&v); add(u,v); }toposort(n); // HDU 的 OJ 不要脸,行尾多了空格算 Presentation Error for(int i=1;i<n;++i) { printf("%d ",ans[i]); }printf("%d\n",ans[n]); }return 0; }
 ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-10-05 08:24:46, Gzip enabled