Codeforces Round #599 (Div. 2) D. 0-1 MST Description Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a descr…
排序+暴力 #include<bits/stdc++.h> using namespace std; #define int long long #define N 1005000 int arr[N]; signed main(){ int _,n; cin>>_; while(_--){ cin>>n; ;i<=n;i++) cin>>arr[i]; sort(arr+,arr++n); ; ;i<=n;i++){ ; ; ;j--){ if…
Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate. The path consists of nn consecutive tiles, numbered from 11 to nn. Ujan will paint each tile in some color…
This problem is different from the easy version. In this version Ujan makes at most 2n2n swaps. In addition, k≤1000,n≤50k≤1000,n≤50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you can hack the previou…