UV 610, uva610

Source: Internet
Author: User

UV 610, uva610
Ultraviolet A 610-Street Directions ctions

Question Link

Given an undirected graph, it is required to set as many edges as possible to form a strongly connected graph. After the directed graph is output, the edges that cannot be targeted become two directed edges.

Idea: Find the cut edge. Only the cut edge must be set to two. In other double-connected components, the edge can be directed, and then print the path without the cut edge in dfs, finally, the cut edge is printed (split into two parts)

Code:

#include <cstdio>#include <cstring>#include <vector>using namespace std;const int N = 1005;int n, m;struct Edge {int u, v, id;int fan;bool iscut, used;Edge() {}Edge(int u, int v, int id, int fan) {this->u = u;this->v = v;this->id = id;this->fan = fan;used = false;iscut = false;}};int pre[N], low[N], dfs_clock;vector<Edge> g[N];vector<Edge> cut;int dfs(int u, int fa) {int lowu = pre[u] = ++dfs_clock;for (int i = 0; i < g[u].size(); i++) {int v = g[u][i].v;int id = g[u][i].id;if (id == fa) continue;if (!pre[v]) {int lowv = dfs(v, id);lowu = min(lowu, lowv);if (lowv > pre[u]) {cut.push_back(g[u][i]);g[u][i].iscut = true;g[v][g[u][i].fan].iscut = true;}} else lowu = min(lowu, pre[v]);}return low[u] = lowu;}void find_cut(int n) {cut.clear();memset(pre, 0, sizeof(pre));dfs_clock = 0;for (int i = 0; i < n; i++) {if (!pre[i]) {dfs(i, 0);}}}int vis[N];void print(int u) {vis[u] = 1;for (int i = 0; i < g[u].size(); i++) {if (g[u][i].iscut) continue;if (g[u][i].used) continue;int v = g[u][i].v;g[u][i].used = true;g[v][g[u][i].fan].used = true;printf("%d %d\n", u + 1, v + 1);if (vis[v]) continue;print(v);}}int main() {int cas = 0;while (~scanf("%d%d", &n, &m) && n || m) {int u, v;for (int i = 0; i < n; i++)g[i].clear();for (int i = 1; i <= m; i++) {scanf("%d%d", &u, &v);u--; v--;g[u].push_back(Edge(u, v, i, g[v].size()));g[v].push_back(Edge(v, u, i, g[u].size() - 1));}find_cut(n);printf("%d\n\n", ++cas);memset(vis, 0, sizeof(vis));for (int i = 0; i < n; i++)if (!vis[i]) print(i);for (int i = 0; i < cut.size(); i++) {printf("%d %d\n", cut[i].u + 1, cut[i].v + 1);printf("%d %d\n", cut[i].v + 1, cut[i].u + 1);}printf("#\n");}return 0;}



Sat reading 570, mathematics 780, syntax 630, TOEFL 100, and average A score of 75. How can this problem be solved in the United States?

How can this problem be solved? You have to find an intermediary or an agency to ask the best question. It varies from person to person.
I think some of the 20-30 are still quite interesting, such as U. michigan or. It seems that 30-40 is more appropriate ~
It's just my thoughts...

How can I protect my acne skin?

I recommend that you use the yingzhuang green tea acne series products, which are not expensive and very easy to use. I learned a lot from high school, resulting in a lot of acne and acne marks, which is quite distressing. After the college entrance examination, I made up my mind to clean up my acne. After the summer vacation, my acne marks were almost pale. When I got to college, my classmates never believed that my face was a lab of acne, I still envy my skin.
This series of effective cream is quick acne. The latest acne ingredients make acne quickly dry and fall off, and can effectively clear the accumulation scars and acne marks caused by acne; Enhance skin resistance, effectively combat the bacteria that cause acne and hair follicle parasites, acceleration of acne removal process; balanced moisturizing, it can sweep off the existing acne and effectively suppress latent acne; mild nature, no stimulation, no side effects.
Method of use: After cleansing in the morning and evening, take the right amount of this product applied to the face, swelling, acne and other defective parts, severe skin can be added to the amount of points coated.
One day later: red and swollen, itchy marks, and more oily face.
Three days later: acne quickly dried and peeled off.
Five days later: Eliminate acne marks, skin whitening and softening
(This solution is used in combination with the effective acne solution, and the acne effect is more remarkable)
The price of this skin care product is not high, and the counter is generally about 103. I think it is worth the money.
It is not a solution to skin whitening and acne removal simply by using skin care products. You need to change your diet habits. Boys, there is no girl with patience in skin maintenance, but you should pay attention to it. If your skin is not shining, you must regularly exfoliate the skin, and the Deep Cleansing Mask should also be done, hydrating is also very important for people with acne. Don't think you are a boy, you can be lazy, O (∩) O ~
Let me introduce some small methods of nursing at ordinary times. The results are really good.
1. Get up and drink 2 glasses of water every day. Add some salt to one of the cups to clear the stomach and stomach.
2. Wash your face with warm water and then use cold water to make the skin clean and the capillary hole will become smaller.
3. Be sure to drink plenty of water without staying up late, eat less fried items, and keep your skin clean.
4. Drink less water at night, drink more water during the day, and apply a brightening mask before going to bed; eat more fruits, do not drink, do not smoke, do not stay up late, ensure that the skin is transparent.
5. First, apply your eyes to the cold tea for five minutes, and then perform a yoga-like action. This action is to put your legs on the plate, raise your hands, and then kneel down to maintain this posture for about ten minutes. This action is not easy to do for ten minutes at the beginning. It takes some time to practice, but the effect is really good.
6. commercial pure water bottle (600cc) less than 20 yuan, as long as a week with pure water wash 3 ~ Four times, and often with makeup cotton dipped in pure water, face naturally beautiful oh !!
7. If you are a boy, do not think that sun protection is a girl's skill. Boys should also pay attention to it. According to medical reports, the ultraviolet rays in the sun, apart from the common known ultraviolet and ultraviolet rays, are also called UVC, which usually appears in the sun, and UVC and ultraviolet B are prone to sunburn, but do not think that there is no need for sun protection on the cloudy day, because there are still ultraviolet and long-wave rays in the cloudy day will cause damage to the skin, so you need to have a good sunscreen to prevent the Early occurrence of aging!
8. Hot Springs and hot springs can not only smooth and smooth skin, but also eliminate fatigue. If you have skin allergies, the effective hot springs can be improved !!
9. Small remedies: black sugar + Honey + a little bit of water; although a little troublesome, it can make skin tender water oh!
10. put sour milk into fresh milk (should be closed) for 24 hours, it takes a little longer in winter, and then put it in the refrigerator for refrigeration can be used, make a little more can be used for drinking, it was originally used to lose weight! But it is better to apply your face, and the whitening effect is good. But I have to endure the sour taste of yogurt !!
11. It is easy to have acne-free skin:
A. Diet: reject any spicy, fried food. Eat more vegetables and fruits and drink more water.
B. Sleep: you must go to bed before every day.
16. As long as you feel the pores are thick, you can use the following kinds of different masks to apply to your face:
A. Apply the protein directly to your face for dry rinse.
B. Soak the dried paper in the milk and apply it to the skin for skin whitening.
Stick to acne! Make sure to thoroughly clean and exfoliate your face before applying your face or something. Otherwise, your skin care products will not be easy to absorb. I wish you an early farewell to acne.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.