CF1423I.Lookup Tables
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The first line contains two integers K and Q ( $ 1 <= K <= 16$ , 1<=Q<=2⋅105 ).
Each of the next Q lines contains three integers li , ri and vi . ( 0≤li≤ri<22K , 0≤vi<216 ).
输入格式
On the first line output "possible" (without quotes) if two tables satisfying the conditions exist, or "impossible" (without quotes) if they don't exist.
If a solution exists, in the next 2⋅2K lines your program should output all values of the two lookup tables (LSBTable and MSBTable) it found. When there are multiple pairs of tables satisfying the conditions, your program may output any such pair.
On lines 1+i output LSBTable[i] . ( 0≤i<2K , 0≤LSBTable[i]<216 ).
On lines 1+2K+i output MSBTable[i] . ( 0≤i<2K , 0≤MSBTable[i]<216 ).
输出格式
A closed interval [a,b] includes both a and b.
In the first sample, tables LSBTable=[1,3] and MSBTable=[1,3] satisfy the conditions: F[0]=LSBTable[0]&MSBTable[0]=1&1=1 , F[1]=LSBTable[1]&MSBTable[0]=3&1=1 , F[2]=LSBTable[0]&MSBTable[1]=1&3=1 , F[3]=LSBTable[1]&MSBTable[1]=3&3=3 .
In the second sample, tables LSBTable=[3,3,2,2] and MSBTable=[0,3,0,1] satisfy all the conditions.
In the third sample there are no two lookup tables which can satisfy the conditions.
输入输出样例
输入#1
1 2 0 2 1 3 3 3
输出#1
possible 1 3 1 3
输入#2
2 4 4 5 3 6 7 2 0 3 0 12 13 1
输出#2
possible 3 3 2 2 0 3 0 1
输入#3
2 3 4 4 3 5 6 2 12 14 1
输出#3
impossible
说明/提示
A closed interval [a,b] includes both a and b.
In the first sample, tables LSBTable=[1,3] and MSBTable=[1,3] satisfy the conditions: F[0]=LSBTable[0]&MSBTable[0]=1&1=1 , F[1]=LSBTable[1]&MSBTable[0]=3&1=1 , F[2]=LSBTable[0]&MSBTable[1]=1&3=1 , F[3]=LSBTable[1]&MSBTable[1]=3&3=3 .
In the second sample, tables LSBTable=[3,3,2,2] and MSBTable=[0,3,0,1] satisfy all the conditions.
In the third sample there are no two lookup tables which can satisfy the conditions.