Bzoj 4143: [AMPPZ2014]The Lawyer

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Bzoj 4143: [AMPPZ2014]The Lawyer相关的知识,希望对你有一定的参考价值。

?????????amp   long   ring   ret   ??????   putc   --   max   algorithm   

Bzoj 4143: [AMPPZ2014]The Lawyer

??????,?????????????????????..( ~~ ????????????AMPPZ2014.... ~~

??????????????????????????????,???????????????????????????.

/*header*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i , x, p) for(int i = x;i <= p;++ i)
#define sep(i , x, p) for(int i = x;i >= p;-- i)
#define gc getchar()
#define pc putchar
#define ll long long
#define mk make_pair
#define fi first
#define se second
using std::min;
using std::max;
using std::swap;

inline int gi() {
    int x = 0,f = 1;char c = gc;
    while(c < '0' || c > '9') {if(c == '-')f = -1;c = gc;}
    while(c >= '0' && c <= '9') {x = x * 10 + c - '0';c = gc;}return x * f;
}

void print(int x) {
    if(x < 0) pc('-') , x = -x;
    if(x >= 10) print(x / 10);
    pc(x % 10 + '0');
}

int max_d[23] , min_d[23];
int idmax_d[23] , idmin_d[23];

void gmin(int &x , int y) {x = x > y ? y : x;}
void gmax(int &x , int y) {x = x > y ? x : y;}

int main() {
    int n = gi() , m = gi();
    rep(i , 1, m) max_d[i] = -1e9 , min_d[i] = 1e9;
    rep(i , 1, n) {
        int l = gi() , r = gi(), d = gi();
        if(max_d[d] < l) {idmax_d[d] = i;max_d[d] = l;}
        if(min_d[d] > r) {idmin_d[d] = i;min_d[d] = r;}
    }
    rep(i , 1, m) {
        if(max_d[i] <= min_d[i]) puts("NIE");
        else {
            printf("TAK %d %d
", idmin_d[i],idmax_d[i]);
        }
    }
    return 0;
}

以上是关于Bzoj 4143: [AMPPZ2014]The Lawyer的主要内容,如果未能解决你的问题,请参考以下文章

bzoj4152[AMPPZ2014]The Captain 最短路

Bzoj 4145: [AMPPZ2014]The Prices

bzoj4152[AMPPZ2014]The Captain*

BZOJ4152[AMPPZ2014]The Captain 最短路

bzoj4152: [AMPPZ2014]The Captain

bzoj4152 [AMPPZ2014]The Captain