#2559. P3172 - 【图的存储】邻接矩阵无向图 - JOYSKID
P3172 - 【图的存储】邻接矩阵无向图 - JOYSKID
题目描述
一个国家有 lns="http://www.w3.org/1998/Math/MathML">nn 个城市,编号为 lns="http://www.w3.org/1998/Math/MathML">11 至 lns="http://www.w3.org/1998/Math/MathML">nn,被已有的 lns="http://www.w3.org/1998/Math/MathML">mm 条高速公路连接。现在政府决定建造新的高速公路,有 lns="http://www.w3.org/1998/Math/MathML">qq 项提议,每项提议计划在 lns="http://www.w3.org/1998/Math/MathML">x,yx,y 城市间建造一条新的高速公路。当然有些提议中某两个城市间可能已经存在高速公路了,那么这项提议将会取消,反之则会通过。
输入格式
第一行三个整数 lns="http://www.w3.org/1998/Math/MathML">n,m,qn,m,q;
接下来 lns="http://www.w3.org/1998/Math/MathML">mm 行,每行两个整数 lns="http://www.w3.org/1998/Math/MathML">x,yx,y,表示已有的高速公路;
接下来 lns="http://www.w3.org/1998/Math/MathML">qq 行,每行两个整数 lns="http://www.w3.org/1998/Math/MathML">x,yx,y,表示一项提议。
注意: Accepted 的提议不会立即建造,不要当作已存在。
输出格式
对于每个 lns="http://www.w3.org/1998/Math/MathML">x,yx,y,如果通过,则输出 Accepted;否则,输出 Cancel。
5 5 3
1 2
2 3
3 4
4 5
5 3
5 4
1 5
1 2
0<n,m≤100,q≤n∗(n−1),1≤x,y≤n
输入输出量较大,请使用较快速的方法,比如scanf、printf```