Submit | All submissions | Best solutions | Back to list |
EXCLSEC - Exclusive Security |
Ashton Carl McDonald (known as A.C.M.) works at a company called XOR (XptO Revolution). The company has a simple rule for employee identification: each employee must have an integer id that must be unique (no two employees may have the same id).
Recently, the employees were grouped into teams, in the following way: the teams are intervals on the XOR’s employees list. An employee can be part of more than one team.
The company wants to hire new employees, and needs to generate id numbers for them. However, due to a security flaw in Human Resources software, the company can’t assign a new number that, if one executes Exclusive-Or operation with all numbers of any team, results in 0.
McDonald, as the leader lazy programmer of XOR, needs your help to determine if a given number can or can’t be assigned to a new employee.
Input
The input contains multiple test cases.
The first line of each test case contains three numbers, N, T and Q, the number of employees in the company, the number of teams and the number of new numbers to be queried, respectively.
The second line contains N numbers Xi, 1 <= i <= N, distinct, the employees id numbers.
Each one of the following E lines contains two numbers, A and B, which represent an interval that forms a team. It means that the employees identified by XA, …, XB form one team.
Each one of the following Q lines contains one number Yj, the queried number.
Limits: 1 <= N, T, Q <= 105, 1 <= A <= B <= N. All Xi and Yj will be non-negative and fit into a signed 32 bit integer, and all queries must be treated as independent from others (just the initial employees and teams must be taken into account).
Output
For each test case, the program must print Q + 1 output lines. For each queried number, the program must print ‘Y’, if the number can be assigned to a new employee, or ‘N’, otherwise. The last line is a simple minus sign ‘-’.
Example
Input: 3 2 4
1 2 4
1 2
1 3
3
5
6
7
0 0 0 Output: N
Y
Y
N
-
Added by: | Paulo Costa |
Date: | 2012-02-08 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | UFCG |
hide comments
2014-03-30 18:59:35 Rishav Goyal
1. Input Ends with 0 0 0. don't print '-' sign for that. 2. "each employee must have an integer id that must be unique" is part of the ruling out restrictions. Last edit: 2014-03-30 19:00:03 |
|
2012-10-04 06:34:02 Shaka Shadows
@Somya Srivastava a O (NlogN + (Q + T)logT) is enough to pass the time limit. There should be something wrong in your code. |
|
2012-10-04 06:01:11 Shaka Shadows
OK, I got AC, but I think the statement needs to be fixed. It's not totally clear that "each employee must have an integer id that must be unique" is part of the ruling out restrictions. Not me, a common coder, but Rujia Liu himself agreed with this, so please, make that clear to avoid a lot of WA for many other coders. |
|
2012-10-04 05:39:17 Shaka Shadows
Is there something weird with this problem? Firstly, it's not totally clear how does the input end, and second, I have submitted 4 codes which seem correct and all of them got WA. Last edit: 2012-10-04 05:41:26 |
|
2012-09-23 04:03:00 Jitendra
"The last line is a simple minus sign..." should be read as : print a line with '-' after each case. |
|
2012-02-11 10:33:11 Somya Srivastava
Even nlogn gives TLE :( |