0w1

Entries from 2016-07-14 to 1 day

CFR 606 D. Lazy Student ( MST )

http://codeforces.com/contest/606/problem/D Having MST, we will first want to sort the edges according to their weight. If we assign for each edge from which has smaller weight, if it is to be part of the MST, we will have to have it conne…

CFR Educational 14 D. Swaps in Permutation ( Union Find )

http://codeforces.com/contest/691/problem/D Being able to swap as many times, that means swappable positions are in the same disjoint set, where in each disjoint set values in those positions could be arranged arbitrarily. We have to manag…

CFR 606 C. Sorting Railway Cars ( Ad hoc )

http://codeforces.com/contest/606/problem/C Imagine if we decided exactly which cars are going to be moved, and of course each of them will be moved no more than once( quite obvious ). The ones left, putting them into a separate sequence, …

CFR Educational 14 C. Exponential notation ( Implementation )

http://codeforces.com/contest/691/problem/C Well, I thought it was not quite easy, some details need to be wary of. void solve(){ string s; cin >> s; int _t; // cut off leading zeros for( _t = -1; _t + 1 < s.size(); ++_t ) if( s[ _t + 1 ] …

POJ 1741 Tree( Centroid D&C )

#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <set> #include <utility> #include <functional> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair< int, int > pii; typedef vector< int > vi; typedef vector< vi >…</functional></utility></set></stack></queue></vector></algorithm></iostream>