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_23318433_770.cpp:1:1655: fatal error: GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stdc++.h>typede: Invalid argument
 #include<bits/stdc++.h>typedef long long ll;using namespace std;const int MAXN = 1e5 + 10;const int M = 2e3;int n, m, K;struct Edge {int to, w, next;  }e[M << 1];int cnt, head[M << 1];void addedge(int u, int v, int w) {e[cnt].to = v;e[cnt].w = w;e[cnt].next = head[u];head[u] = cnt++;}int a[MAXN], b[MAXN], c[MAXN];int dfn[M], sz;stack<int> sta;struct Item {int s;int x;Item(int s, int x):s(s), x(x) {}bool operator<(const Item& other) const {return s < other.s;}};void cal() {priority_queue<Item> q;for(int i = 1; i <= b[0]; i++) {q.push(Item(a[1] + b[i], 2));}c[0] = 0;while(c[0] < K && !q.empty()) {Item it = q.top(); q.pop();c[++c[0]] = it.s; if(it.x <= a[0]) q.push(Item(it.s - a[it.x - 1] + a[it.x], it.x + 1));}a[0] = c[0];for(int i = 1; i <= c[0]; i++) {a[i] = c[i];}}int tarjan(int fa, int u) {dfn[u] = ++sz;int lowu = sz;for(int i = head[u]; ~i; i = e[i].next) {int v = e[i].to;if(!dfn[v]) {sta.push(i);int lowv = tarjan(u, v);if(lowu <= lowv) {b[0] = 0;while(1) {int j = sta.top(); sta.pop();b[++b[0]] = e[j].w;if(j == i) break;}if(b[0] > 1) cal();} else lowu = lowv;} else if(v != fa && lowu > dfn[v]) {sta.push(i);lowu = dfn[v];}}return lowu;}int main() {int kase = 1;while(~scanf("%d%d", &n, &m)) {while(!sta.empty()) sta.pop();cnt = 0;sz = 0;memset(dfn, 0, sizeof dfn);memset(head, -1, sizeof head);a[0] = 1; a[1] = 0;int s = 0;for(int i = 0; i < m; i++) {int u, v, w;scanf("%d%d%d", &u, &v, &w);s += w;addedge(u, v, w); addedge(v, u, w);}scanf("%d", &K);tarjan(-1, 1);unsigned ans = 0;for(int i = 1; i <= a[0]; i++) {ans = ans + (unsigned)i * (s - a[i]);}         if(a[0] == 0) ans = s;printf("Case #%d: %u\n", kase++, ans);}   return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ^
compilation terminated.


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-11-27 02:59:15, Gzip enabled