Flights No. 1493 of national airlines

Source: Internet
Author: User

Flights No. 1493 of national airlines

Link to the question: Ultraviolet a 1493-Draw a Mess

Given a rectangle range, there are four coloring methods. After that, the color will overwrite the previous color. Finally, I will ask the nine colors each occupy the same area.

Solution: Use the query set to maintain each location corresponding to the next location that can be colored. Then the color is reversed to solve the problem of color coverage.

#include <cstdio>#include <cstring>#include <cstdlib>#include <cmath>#include <algorithm>using namespace std;const int maxr = 205;const int maxc = 50005;int N, M, Q, cnt[15];int f[maxr][maxc];struct Order {    int sign, star, end;    int x, y, r, w, c;    void set (int sign, int x, int y, int c, int r, int w = 0) {        this->sign = sign;        this->x = x;        this->y = y;        this->c = c;        this->r = r;        this->w = w;        del_star();    }    void del_star () {        if (sign < 2) {            star = max(x - r, 0);            end = min(x + r, N - 1);        } else if (sign == 2) {            r = (r + 1) / 2 - 1;            star = x;            end = min(x + r, N-1);        }    }}op[maxc];int getfar (int* far, int x) {    return x == far[x] ? x : far[x] = getfar(far, far[x]);}int style (char ch) {    if (ch == 'C')        return 0;    else if (ch == 'D')        return 1;    else if (ch == 'T')        return 2;    else        return 3;}void init () {    memset(cnt, 0, sizeof(cnt));    for (int i = 0; i <= M; i++) {        for (int j = 0; j < N; j++)            f[j][i] = i;    }    char s[20];    int x, y, r, c, w;    for (int i = 1; i <= Q; i++) {        scanf("%s", s);        if (s[0] != 'R') {            scanf("%d%d%d%d", &x, &y, &r, &c);            op[i].set(style(s[0]), x, y, c, r);        } else {            scanf("%d%d%d%d%d", &x, &y, &r, &w, &c);            op[i].set(style(s[0]), x, y, c, r, w);        }    }}inline int get_R (int r, int x, int i, int sign) {    if (sign == 0)        return (int)sqrt(1.0 * r * r - 1.0 * (x - i) * (x - i));    else if (sign == 1)        return r - abs(x - i);    else if (sign == 2)        return r - (i - x);    return 0;}int count (int x, int y, int r, int star, int end, int sign) {    int ret = 0;    for (int i = star; i <= end; i++) {        int R = get_R(r, x, i, sign);        int mv = max(y - R, 0);        while (mv = getfar(f[i], mv), abs(mv - y) <= R && mv < M) {            ret++;            f[i][mv] = mv+1;        }    }    return ret;}int count_rec (int x, int y, int r, int l) {    int ret = 0;    for (int i = x; i <= x + r - 1 && i < N; i++) {        int mv = y;        while (mv = getfar(f[i], mv), abs(mv - y) < l && mv < M) {            ret++;            f[i][mv] = mv+1;        }    }    return ret;}void solve () {    for (int i = Q; i; i--) {        int& col = cnt[op[i].c];        if (op[i].sign == 3)            col += count_rec(op[i].x, op[i].y, op[i].r, op[i].w);        else            col += count(op[i].x, op[i].y, op[i].r, op[i].star, op[i].end, op[i].sign);    }    for (int i = 1; i <= 9; i++)        printf("%d%c", cnt[i], i == 9 ? '\n' : ' ');}int main () {    while (scanf("%d%d%d", &N, &M, &Q) == 3) {        init();        solve();    }    return 0;}

15 years old, what should I do with sunscreen?

In fact, sunscreen is similar. It is difficult for you to choose sensitive skin. There are two ways to be sensitive. One is to buy physical sunscreen and the other is to buy medical makeup. Generally, big names have physical sunscreen, but the price is relatively high. Dhc has a physical model and is currently engaged in activities for 98 members, the effect is very good. What about medical makeup? You go to a large drug store and have their own sunscreen at about three hundred of the Price. Few people are allergic to medical makeup. As for the thin water you mentioned, it is refreshing and oily, but not only suitable for oily skin. My skin is neutral and I use thin water. If you are afraid of allergies, you can apply some products to the ear lobe to see if there is any adverse reaction. If you don't have it, you can use it. I think water thinning is the most cost-effective. And sunscreen should have been applied to all the places you said.


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.