Ultraviolet A 1400, ultraviolet

Source: Internet
Author: User

Ultraviolet A 1400, ultraviolet

Link to the question: Ultraviolet 1400-"Ray, Pass me the dishes! "

Given a sequence of n integers, give an answer to m queries. For each query (a, B), find two subscripts x, y makes the continuity from x to y equal to the maximum continuous sum in the range a and B. If multiple solutions exist, x is given priority and y is smaller.

Solution: The line segment tree maintains three line segment values for each node:

  • Max_sub: Maximum consecutive intervals and
  • Max_prefix: Maximum range continuous prefix and
  • Max_suffix: Maximum range continuous suffixes and
    The Build Process maintains three values. You only need to consider max_sub of the left and right subnodes and max_suffix + max_prefix on both sides of the query.
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;#define lson(x) ((x)<<1)#define rson(x) (((x)<<1)+1)typedef long long ll;const int maxn = 500005;const ll INF = 0x3f3f3f3f3f3f3f3f;struct segment {    int l, r;    ll val;    segment (int l = 0, int r = 0, ll val = 0) {        this->set(l, r, val);    }    void set (int l, int r, ll val) {        this->l = l;        this->r = r;        this->val = val;    }    segment operator + (const segment& u) {        return segment(min(l, u.l), max(r, u.r), val + u.val);    }    bool operator < (const segment& u) const {        if (val != u.val)            return val < u.val;        if (l != u.l)            return l > u.l;        return r > u.r;    }};struct Node {    int l, r;    segment max_sub, max_prefix, max_suffix;} node[4*maxn];int N, M;ll arr[maxn], s[maxn];Node seg_push (Node a, Node b) {    Node ret;    ll suml = s[a.r] - s[a.l-1];    ll sumr = s[b.r] - s[b.l-1];    ret.l = a.l;    ret.r = b.r;    ret.max_sub = max(a.max_suffix + b.max_prefix, max(a.max_sub, b.max_sub));    ret.max_prefix = max(a.max_prefix, segment(a.l, a.r, suml) + b.max_prefix);    ret.max_suffix = max(b.max_suffix, a.max_suffix + segment(b.l, b.r, sumr));    return ret;}void build_segTree (int root, int l, int r) {    if (l == r) {        node[root].l = node[root].r = l;        node[root].max_sub.set(l, r, (ll)arr[l]);        node[root].max_prefix.set(l, r, (ll)arr[l]);        node[root].max_suffix.set(l, r, (ll)arr[l]);        return;    }    int mid = (l + r) / 2;    build_segTree(lson(root), l, mid);    build_segTree(rson(root), mid + 1, r);    node[root] = seg_push(node[lson(root)], node[rson(root)]);}Node query (int root, int l, int r) {    if (l <= node[root].l && r >= node[root].r)        return node[root];    int mid = (node[root].l + node[root].r) / 2;    if (l <= mid && r > mid)        return seg_push(query(lson(root), l, r), query(rson(root), l, r));    else if (r <= mid)        return query(lson(root), l, r);    else        return query(rson(root), l, r);}int main () {    int cas = 1;    while (scanf("%d%d", &N, &M) == 2) {        s[0] = 0;        for (int i = 1; i <= N; i++) {            scanf("%lld", &arr[i]);            s[i] = s[i-1] + arr[i];        }        build_segTree(1, 1, N);        printf("Case %d:\n", cas++);        int l, r;        for (int i = 0; i < M; i++) {            scanf("%d%d", &l, &r);            Node u = query(1, l, r);            printf("%d %d\n", u.max_sub.l, u.max_sub.r);        }    }    return 0;}

Why is roadway banned because it is too evil?

The sun rays include infrared (> 770nm) and visible (400 ~ Continuity spectrum in the 770nm and UV (<400nm) ranges. UVC with a wavelength below 280nm is almost completely absorbed in the atmosphere (ozone layer), with very few ultraviolet rays reaching the Earth's surface. The response of human skin to ultraviolet rays in different wavelength ranges. Visible and Infrared ranges (400 ~ 1400 nm) radiation will make the skin red, but soon after the radiation subsided; 320 ~ Ultraviolet rays at the wavelength of 280 nm (ultraviolet) Will oxidized the reduced melanin in the epidermis, and directly tan the skin, generally not causing erythema ~ 320nm (ultraviolet B) wavelength ultraviolet rays can cause acute dermatitis (erythema) and burns on the skin. Before 1980s, sun protection products mainly prevent ultraviolet rays in the ultraviolet ray area, but little attention is paid to ultraviolet rays in the ultraviolet area. In recent years, skin medical research has found that the total ultraviolet energy of ultraviolet rays reaches 98% of the human body, which is far more penetrating than ultraviolet rays on glass, clothing, water and human skin, although the effect on human skin is slow, the accumulation of time can cause serious damage.

Burned during military training

We recommend that you apply a DIY aloe + lemon mask (Aloe Vera + lemon juice) to your sleep at night )~ Good results ~ Moisturizing and Whitening ~ It is very good to fix it after drying ~ However, be aware that vitamin C is addictive ~ It is best to turn off the light and use it ~ This mask can be used throughout the body ~ Smooth skin when used up ~~ Wash a warm water bath before going to bed at night, then apply it, massage it to let it naturally absorb ~ Maybe 30 minutes ~~ (Do not massage may feel a little tight)

Nutritional and moisturizing Functions

The amino acids and composite polysaccharide contained in Aloe Vera are natural moisturizing factors (NMF ). This natural moisturizing factor can supplement part of the lost moisture in the skin, restore the functionality of collagen, prevent facial wrinkles, and maintain smooth, soft, and elastic skin. Because Aloe Vera contains polysaccharide and a variety of simple sugar, and the presence of magnesium lactate with traces, aloe vera gel has a natural wet performance and delay the rate of moisture loss from cosmetic cream and shampoo. Experiments show that aloe vera gel can delay the evaporation rate of water in the oil emulsion. Aloe vera gel can enhance water permeability, it can penetrate into the skin surface, so that water directly enters the tissue. Aloe vera gel increases the penetration of the skin because of hydrolysis, occlusion, and increase the solubility of compounds, so that it increases the penetration of the skin. Polysaccharide and paste form a solid coating layer as the occlusion sealing layer, which can prevent moisture evaporation on the surface of the skin. After investigation, aloe vera gel can be applied in various products. It has been pointed out that aloe vera gel can obviously be used in wet products. The gel not only can coexist with anionic but also non-ionic and cationic systems. Adding aloe vera gel to soap is especially meaningful. It is used to make soap clean without drying the skin. Due to the mild properties of the gel, the soap made does not have the risk of irritation. Aloe vera ointment is another application of polysaccharide in soap products. In the recommended formula 4, the gel acts as a lubricant and as a moisturizer. Because of Aloe vera's stickiness, it can be used as a protective layer between skin and beard like silicon. The gel has been used in many products to remove burns. In addition to the so-called healing, it can also maintain moisture on the damaged skin, wet is the basic condition for healing. It is an extremely simple product that has proven to have good results. It is a deburn spray consisting of Lidocaine HCl and aloe vera gel, it is a basic product. in people's minds, it is a natural product, not a medical product. These are only a few types of Aloe vera gel products that can be used. Aloe vera gel can be used independently or together with other ingredients in any system that requires mild and humid use. Therefore, aloe vera gel is an ideal natural moisturizing factor for all kinds of cosmetics.

Aloe Vera

It is also known as aloe vera, and it is also called aloe vera. Roots, stem short, leaves clustered in the top of the stem. The leaves are arranged in a spiral shape, with thick fat juice. Leaves 30-70 cm long, 4-15 cm wide, 2-5 cm thick, Apex gradually tip, base wide; leaves pink green, cloth with white spots, gradually disappear with the growth of the leaves, the left side of the leaf is a thorn-like tooth. The stems are single-grown and have two or three branches with a height of 60-120 cm. The rackets are scattered and put down.
Tedol: it can be used in food, medicine, beauty products and other aspects. It is mainly used to extract aloe vera juice, concentrated juice, crystalline powder, and some of them are also used for home potted ornamental purposes.

Sunscreen Effect
The sun rays include infrared (> 770nm) and visible (400 ~ Continuity spectrum in the 770nm and UV (<400nm) ranges. UVC with a wavelength below 280nm is almost completely absorbed in the atmosphere (ozone layer), with very few ultraviolet rays reaching the Earth's surface. The response of human skin to ultraviolet rays in different wavelength ranges. Visible and Infrared ranges (400 ~ 1400 nm) radiation will make the skin red, but soon after the radiation subsided; 320 ~ Ultraviolet rays at the wavelength of 280 nm (ultraviolet) Will oxidized the reduced melanin in the epidermis, and directly tan the skin, generally not causing erythema ~ 320nm (ultraviolet B) wavelength ultraviolet rays can cause acute dermatitis (erythema) and burns on the skin. Before 1980s, sun protection products mainly prevent ultraviolet rays in the ultraviolet ray area, but little attention is paid to ultraviolet rays in the ultraviolet area. In recent years, skin medical research has found that the total ultraviolet energy of ultraviolet rays reaches 98% of the human body, which is far more penetrating than ultraviolet rays on glass, clothing, water and human skin, although the effect on human skin is relatively slow, but day accumulation month ...... remaining full text>

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.