#include #include #include #include #include using namespace std; #define MAXN 11111 // Struktura pro hranu s operátorem porovnávání struct E { int u; int v; int w; // Operátor pro třídění sestupně bool operator<(const E & e) const { return (w > e.w); } }; int n, m; // Počet vrcholů a hran int parent[MAXN]; // Rodič pro DFU int rank[MAXN]; // Rank v rámci DFU int back[MAXN]; // Předchůdci v BFS vector edges; // Seznam hran vector graf[MAXN]; // Reprezentace grafu // Inicializace DFU void dfu_inic() { for (int i=0; irank[v]) swap(u, v); parent[u] = v; rank[v] += (rank[u]==rank[v]); } int main() { // Načtení vstupu a vytvoření seznamu hran scanf("%d%d", &n, &m); for (int i=0; i q; for (int i=0; i