avi007.aps's blog

By avi007.aps, history, 11 years ago, In English

This is link to my solution http://mirror.codeforces.com/contest/554/submission/11743299 When i am running on my compiler i am getting right answer i.e 2 but it is showing 3 on codeforce.

  • Vote: I like it
  • +2
  • Vote: I do not like it

| Write comment?
»
11 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

I'm not too familiar with C++ syntax, but I would guess than the line: cin>>x; reads in a whole line since there are no white spaces, thus storing all n lines in the first vector (so all the other three are empty and therefore equal). When you did it on your compiler did you separate the 1's and 0's by white spaces?

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

    Yes

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

      That would explain the difference then. When solving the problem the input format will be exactly the same as described in the problem statement and as used in the samples. When testing on the sample cases, I would advise copy and pasting the input into your program console or test file to ensure consistency.

»
11 years ago, hide # |
Rev. 2  
Vote: I like it +3 Vote: I do not like it

Cin reads long long without trailing zeros. Change X to char. ACCEPTED

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

You are reading integers of type long long with cin >> x,but in input you have N binary strings.