标签:script pac NPU time return -- The black output
Assigning a balloon color to each problem is one of the tasks we need to do every year, and sometimes itis tricky.
We noticed that some contestants assume some colors for some problems according to the difficulty. Forexample, the easiest problem is the red one and the hardest problem is the black one.
We do not want these assumptions to be true, so we decided to add constraints for the easiest and thehardest problems.
There are N problems, numbered from 1 to N , the easiest problem is problem number 1, and the hardestproblem is problem number N . Also there are N unique colors, for simplicity we will give each color aunique number from 1 to N .
We want to assign each color to exactly 1 problem, such that the easiest problem does not get the colorX and the hardest problem does not get the color Y .
Given N , X , Y and an assignment of the colors, your task is to find if this assignment satisfies the aboveconditions or not.
Input
Your program will be tested on one or more test cases. The first line of the input will be a single integer T,the number of test cases (1 ≤ T ≤ 100). Followed by the test cases, the first line of each test case contains3 integers separated by a single space N X Y (3 ≤ N ≤ 100) and (1 ≤ X , Y ≤ N ) representing thenumber of problems, the color which the easiest problem should not get and the color which the hardestproblem should not get, respectively. Followed by a line which contains N integers separated by a singlespace (each integer from 1 to N should appear exactly once), the first integer is the color for the firstproblem (the easiest), the second integer is the color for the second problem and so on (the last integer isthe color for the hardest problem).
Output
For each test case, print a single line which contains a single word, this word should be (without thequotes):
- “BOTH”: If both the easiest and hardest problems got colors which they should not get.
- “EASY”: If only the easiest problem got a color which it should not get.
- “HARD”: If only the hardest problem got a color which it should not get.
- “OKAY”: If both the easiest and hardest problems got colors which they can get.
4 3 1 2 1 3 2 5 3 4 3 1 2 4 5 6 1 6 2 1 3 4 5 6 7 7 7 1 7 2 3 4 5 6
BOTH EASY HARD OKAY
#include <iostream> using namespace std; int t; int main(){ cin >> t; while (t -- ){ int n, x, y; int a[110]; scanf("%d%d%d", &n, &x, &y); for (int i = 1; i <= n; i ++ ) scanf("%d", &a[i]); if (a[1] == x && a[n] == y) puts("BOTH"); if (a[1] == x && a[n] != y) puts("EASY"); if (a[1] != x && a[n] == y) puts("HARD"); if (a[1] != x && a[n] != y) puts("OKAY"); } return 0; }
E. Balloons Colors[ICPC Arab Collegiate Programming Contest 2013]
标签:script pac NPU time return -- The black output
原文地址:https://www.cnblogs.com/Iamcookieandyou/p/13362602.html