accidentallygivenfuck's blog

By accidentallygivenfuck, history, 6 years ago, In English

My following solution for Leapfrog: Ch. 1 failed:

#include <iostream>
#include <string>
using namespace std;

int T;

int main() {
  cin >> T;
  
  for (int test = 1; test <= T; ++test)
  {
    string s;
    cin >> s;

    int n = s.length();
    int b = 0;
    for (int i = 0; i < n; i++)
      if (s[i] == 'B')
        b++;

    char yesno = ( b+1 <= n-1 && n-1 <= 2*b ?'Y' :'N');
    cout << "Case #" << test << ": " << yesno << "\n";
  }

  return 0;
}

I compared the outputs for the reference solution and mine. But they are the same. diff doesn't find any differences.

Here is the Dropbox folder with my and reference solution's sources, inputs and outputs. I don't believe I submitted the wrong files.

Can someone confirm or reject the validity of my solution?

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You can actually download files you submitted btw

  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes, sorry I forgot to mention it. downloaded-output.txt and src.cpp are files I submitted.

    I couldn't find a way to download the exact input file though. I can only download a new input file for upsolving.

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Well I had my both conditions same as yours and the solution passed.

»
6 years ago, # |
  Vote: I like it +19 Vote: I do not like it

According to our records, it looks like your Leapfrog: Ch. 1 submission did pass, while your Leapfrog: Ch. 2 submission did not. Are you sure your scoreboard indicates that you failed both problems?

  • »
    »
    6 years ago, # ^ |
      Vote: I like it -8 Vote: I do not like it

    Thanks for looking into it.

    That's really weird. Yes, the scoreboard showed I failed both the problems. It's fixed now, but I have a screenshot from before that:

    Any ideas of how that may have happened?

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Hmm, strange, was that taken immediately after the contest ended? It's possible that you submitted your source/output files backwards and we automatically fixed it shortly afterwards, though I wouldn't expect that to appear on the scoreboard — I'll look into it.

      • »
        »
        »
        »
        6 years ago, # ^ |
        Rev. 2   Vote: I like it -8 Vote: I do not like it

        It was taken long after the contest ended.

        • »
          »
          »
          »
          »
          6 years ago, # ^ |
            Vote: I like it +8 Vote: I do not like it

          Ah, yeah, I see you had also submitted a clarification about this. You had made an incorrect submission just after your initial correct one (with the wrong output file), which caused the problem to count as incorrect as we only consider the last submission, but for the purposes of the Qualification Round we then manually adjusted it to ignore that extra submission and be correct. Please be more careful in the future!

          • »
            »
            »
            »
            »
            »
            6 years ago, # ^ |
            Rev. 2   Vote: I like it +13 Vote: I do not like it

            Ah I see what happened. I tried submitting my code and output swapped just to see what happens. The system told me my output format is invalid. I thought it will be auto-ignored.

            I'll be more careful next time. Thanks <3