bzoj4143: [Amppz2014]the Lawyer

Source: Internet
Author: User

4143: [amppz2014]the Lawyer time limit:10 Sec Memory limit:256 mbsec Special Judge
submit:462 solved:257
[Submit] [Status] [Discuss] Descriptionbyteasar to make a plan for the meeting of M days, there are N sessions, the first session begins in the first d[i] days of a[i] seconds, and ends in the b[i] second of the day of the first d[i]. For each day, please find out the two sessions of the day i,j, so that they do not conflict, i.e. there is not a number k while satisfying a[i]<=k<=b[i] and a[j]<=k<=b[j].

The first line of input contains two positive integers n,m (2<=n<=500000,1<=m<=20), representing the number of fields and days of the meeting. Next n rows, each row contains three positive integers a[i],b[i],d[i] (1<=a[i]<b[i]<=80000000,1<=d[i]<=m), describing a meeting.

Output M row. Line I output the answer to day I, if no solution, output nie, otherwise output tak, and then output this day to participate in the number of two sessions, if there are multiple sets of solutions, output any group.

Sample Input6 3
3 5 1
2 4 2
1 8 1
6 7 3
3 5 2
7 1Sample OutputTAK 1 6
NIE
NIE Solvingrecord The earliest end time and the latest start time of the day, no
1/**************************************************************2Problem:41433User:10909007154 language:pascal5 result:accepted6Time:6388Ms7Memory:15852KB8****************************************************************/9  Ten  Programj01; One varN,m,a,b,d:int64; A I:longint; -MA,MB,IDA,IDB:Array[0..500086] ofInt64; - begin the readln (n,m); -    fori:=1  toM Do -   begin -ma[i]:=0; mb[i]:=maxlongint*Maxlongint; +   End; -    fori:=1  toN Do +   begin A readln (a,b,d); at     ifA&GT;=MA[D] Then -     begin -ida[d]:=i; -ma[d]:=A; -     End; -     ifB&LT;=MB[D] Then in     begin -idb[d]:=i; tomb[d]:=b; +     End; -   End; the    fori:=1  toM Do *     ifMa[i]<=mb[i] ThenWriteln ('NIE') $     ElseWriteln ('TAK', Idb[i],' ', Ida[i]);Panax Notoginseng End.

4143: [amppz2014]the Lawyer time limit: ten Sec Memory Limit: mbsec Special Judge
Submit: 462 Solved: 257
[Submit] [Status] [Discuss] Descriptionbyteasar to make a plan for the meeting of M days, there are N sessions, the first session begins in the first d[i] days of a[i] seconds, and ends in the b[i] second of the day of the first d[i]. For each day, please find out the two sessions of the day i,j, so that they do not conflict, i.e. there is not a number k while satisfying a[i]<=k<=b[i] and a[j]<=k<=b[j].

The first line of input contains two positive integers n,m (2<=n<=500000,1<=m<=20), representing the number of fields and days of the meeting. Next n rows, each row contains three positive integers a[i],b[i],d[i] (1<=a[i]<b[i]<=80000000,1<=d[i]<=m), describing a meeting.

Output M row. Line I output the answer to day I, if no solution, output nie, otherwise output tak, and then output this day to participate in the number of two sessions, if there are multiple sets of solutions, output any group.

Sample Input6 3
3 5 1
2 4 2
1 8 1
6 7 3
3 5 2
7 1Sample OutputTAK 1 6
NIE
NIE

bzoj4143: [Amppz2014]the Lawyer

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.