【杭電多校2020】第三場1005.Little W and Contest(並查集)

題目連接 思路: 首先求出全部的2和1的個數並求出他們一共能夠結合成多少對,而後再輸入關係對,用並查集維護關係,再一點一點減去相關聯後減小的對數便可。php 代碼: #include<bits/stdc++.h> #define int long long #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); const i
相關文章
相關標籤/搜索