编程介的小学生 2017-06-10 07:17 采纳率: 20.5%
浏览 742
已采纳

Birthday Gift

Bob wants to chase alice while alice is hard to get. If Bob wants to make a date with alice, Bob has to answer a alice's math problem firstly.

The problem is quite simple. Alice will give m constraints about an array of n positive integers representing as a[1], a[2] .. a[n]. The i-th of the m constraints consists 3 integers li, ri, qi, which means a[li] | a[li+1] | a[li+2] |...| a[ri] = qi. Here operator "|" represent as bitwise or. What Bob needs to do is to guess out the largest and smallest arrays in dictionary order which satisfy the m constraints and each element in the arrays should be positive and less than 2^30 (0

Input

The first line of input is an integer T, indicating the number of test cases. For each test case, the first line contains 2 integers: n, m (1<=n<=10^6,1<=m<=10^5). n is the size of the array, m is the number of constraints.Then follows m lines, the i-th line contains 3 integers li, ri, qi (1<=li<=ri<=n, 0<=qi<2^30) describing the i-th limit.

Output

For each cases, if answers is exists, in the first line print "come on, nice girl!"(without qoutes) then follows 2 lines, the first line contains n integers which represents the smallest array in dictionary order, and the second line conains n integers which represents the largest array in dictionary order. If answers is not exists, just print a line with a sentence "I am a poor guy!"(without qoutes)

Sample Input

2
5 2
3 4 2
1 5 3
3 2
1 3 2
1 3 3
Sample Ouput

come on, nice girl!
0 0 0 2 1
3 3 2 2 3
I am a poor guy!

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-06-28 16:34
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题
  • ¥60 高价有偿求java辅导。工程量较大,价格你定,联系确定辅导后将采纳你的答案。希望能给出完整详细代码,并能解释回答我关于代码的疑问疑问,代码要求如下,联系我会发文档
  • ¥50 C++五子棋AI程序编写
  • ¥30 求安卓设备利用一个typeC接口,同时实现向pc一边投屏一边上传数据的解决方案。