http://codeforces.com/gym/101550/attachments [AC] #include<bits/stdc++.h> using namespace std; typedef long long ll; ; ; int n,m,q; struct node { int x1,y1; int x2,y2; }nd[maxq]; int fir[maxn][maxn]; bool vis[maxn][maxn]; int fa[maxn*maxn]; int id(i…
C. Edgy Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a tree (a connected undirected graph without cycles) of nn vertices. Each of the n−1n−1 edges of the tree is col…
题意:给定N,M,然后给出M组信息(u,v,l,r),表示u到v有[l,r]范围的通行证有效.问有多少种通行证可以使得1和N连通. 思路:和bzoj魔法森林有点像,LCT维护最小生成树. 开始和队友在想维护连通性,而不是维护树,这样好像会很麻烦. 队友yy了一个算法:用线段树模拟并查集维护连通性.(发现和标程有点像? 我的代码:LCT维护最小生成树. ...先给代码,后面补一下题解. #include<bits/stdc++.h> #define ll long long using nam…
The Suspects Time Limit: 1000MS Memory Limit: 20000K Total Submissions: 37090 Accepted: 17980 Description Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. T…
题意: 对于n个数a[0]~a[n-1],但你不知道它们的值,通过逐步提供给你的信息,你的任务是根据这些信息回答问题: I P V :告诉你a[P] = V I P Q V:告诉你a[P] XOR a[Q] = V Q K P1..PK:询问a[P1]^a[P2]^...a[PK]的值 n<=20000 题解: 首先看前两个操作: 第一个操作我们可以新加一个节点a[n]=0,则a[p]=val转化为a[p]^a[n]=val. 那么所有知道值的点必定都与a[n]在同一个并查集之内. 我们…
D-City Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 2448 Accepted Submission(s): 862 Problem Description Luxer is a really bad guy. He destroys everything he met. One day Luxer went to D-city.…
#include<iostream> #include<cstdio> #include<string> #include<cstring> #include<algorithm> #include<vector> #include<queue> using namespace std; int n,m; ; ; int degree[maxn]; int fa[maxn]; struct edge{ int to; in…