Submit | All submissions | Best solutions | Back to list |
Problem hidden on 2015-02-23 16:24:15 by Mitch Schwartz
CDGLF5 - Snow White And Dwarfs |
Snow White And Dwarfs
Snow White and the N dwarfs live in the forest. While the dwarfs mine away ,Snow White hangs around social networks.
Each morning the dwarfs form a long line and go whistling away to the mine. Snow White runs around them and snaps pictures to upload onto her favorite social network.
When dwarfs enter the mine, Snow White goes back to their house and goes through the pictures, selecting pretty ones. Each dwarf has a colored cap.
A picture is pretty if more than x caps on it are of the same color. In other words, if there are K dwarfs on the picture, it is pretty if strictly more than x dwarfs have same colored caps.
Write a program that will check for a set of M pictures if they are pretty, and what color is dominating if they are.
Input
First line of input consists of ‘T’-number of test cases (1<=T<=10).
First line of each test case contains one integer N (3 ≤ N ≤ 300000) number of dwarfs .
Second line contains N integers , colors of dwarves hats, ordered the way they formed the line that morning.(1<=A[i]<=10^8)
Third line contains M (1 ≤ M ≤100000), number of pictures.
Next M lines contain two integers A , B and X (1 ≤ A ≤ B ≤ N). Each line describes one picture. On it there are all dwarves starting from A-th all the way to the B-th.
Output
For each test case, output M lines with answer(either "yes" or "no" ) to each picture in a single line.
Sample Input
1
10
1 2 2 3 3 4 5 5 6 6
4
1 2 2
1 3 4
1 4 2
1 5 3
Sample Output
no
no
no
no
Added by: | CSI |
Date: | 2015-02-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 JS-MONKEY |
hide comments
2015-02-23 16:23:26 Mitch Schwartz
@nalin16: My AC solutions didn't assume they are, but testing reveals that they actually are! This problem is just really badly designed. Although I deserve points for it, I have to hide it. It's really annoying. Edit: I'm trying to consider carefully whether the problem needs to stay hidden (it's kind of nice for golf, and I put a decent amount of work into it; for short code you just have to make some guesses about the way the test data was (badly) generated), but it is hidden for now, with justification. Edit 2: It seems keeping the problem hidden is best, unless problem setter improves the quality of the problem by rewriting description (so that there is no plagiarism, and including hint about data generation method, and mentioning that array values are given in ascending order, etc.) and increasing time limit to maybe 3s (I didn't do tests) for the sake of slower languages. I think it's better not to change data at this point. Last edit: 2015-02-23 20:51:01 |
|
2015-02-23 16:11:05 : : still coding -_- :
are the colours given in ascending order..?? |
|
2015-02-23 05:44:09 Mitch Schwartz
This problem is interesting, but it seems the constraints are very misleading, and a slow approach can pass easily. I might set a classical problem related to this one with proper data and constraints requiring a fast method. (Unless it already exists -- if so, please let me know.) Last edit: 2015-02-23 06:39:36 |
|
2015-02-14 05:33:02 Mitch Schwartz
Note: Problem text is near-duplicate of PATULJCI (and maybe there is permission issue there, but I am not in charge of that). There are few differences here: introduction of "x", elimination of "C" and higher limit on colors, not needing to output dominating color, input format, scoring, time limit. The words "and what color is dominating if they are" were probably kept in task description by accident. Last edit: 2015-02-15 08:57:23 |