Program time limit: 1 second
Program memory limit: 512 MB
$N$ quokkas are performing a dance together!
Each quokka has been given a score, $A_i$ based on how well they danced!
At the end of the dance, judges are handing out a special prize, which belongs to a pair of Quokkas whose scores add up to a certain score $K$.
Your job is to see if this pair exists! Output 'Y' if there exists a pair that can receive prizes, otherwise output 'N'.
For all test cases:
Additionally:
You should read from standard input and write to standard output.
In Python, you could use the following code.
# Taking inputs, already done! :D
N, K = map(int, input().split())
A = list(map(int, input().split()))
flag = False
# Write your code here
# Printing output
if flag:
print("Y")
else:
print("N")
In C or C++, you could use the following code.
// Taking inputs, already done! :D
int N, K; scanf("%d%d", &N, &K);
int A[N]; for (int i = 0; i < N; i++) scanf("%d", &A[i]);
bool flag;
// Write your code here
// Printing output
if (flag == true) {
printf("Y\n");
} else {
printf("N\n");
}
7 67
41 6 7 9 26 4 1
Y
In this case, K is 67, so quokka dancers with the scores 41 and 26 can add up to K, winning their special prize.
For each subtask (worth 50% and 50% of points, as per the Constraints section), your program will be run on multiple secret test cases one after another, and if it produces the correct output for all test cases, it solves that subtask. Your program will receive the points for each subtask it solves. Recall that your final score on the task is the score of your highest scoring submission.
Log in to submit!