• ...And you didn't bother to even change the name of the code blocks.

    If you're just straight out copy-pasting a problem along with their test data sets from another OJ site, don't do it. That's a very poor practice (plagiarizing content from other sites are never a good idea), and in CW you need test code that is at least descriptive, informative and has random tests. Which you have done none of.

  • Besides being a duplicate, the initial code and kata designs needs lots of revise:

    • #include<stdio.h> and using namespace std; should not be included because they are entirely unnecessary
    • #include<queue>? Now that's just a spoiler
    • int n,int* a is a very poor input format for C++ (you're just writing C code in C++ there), please use something actually idiomatic to C++ like const std::vector<int> xs
  • it is strange for soo many 0s lol