RAD's blog

By RAD, 14 years ago, translation, In English

Hi everyone!

The recent testing round went well. It is expected that everything will run faster. Today's round was prepared by: Mike Mirzayanov, Nickolay Kuznetsov, Ivan Fefer and Maria Belova.

Good luck!

Artem Rakhov and Codeforces team

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

| Write comment?
14 years ago, # |
  Vote: I like it 0 Vote: I do not like it
2nd one is a little bit confusing.. Especially "If those rules don't indicate the size of the cut are clearly, then the way with which the cut part possesses the largest area is chosen."
14 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Was the site running extremely slowly or was it just my connection as both have been having their ups and down recently :P
14 years ago, # |
  Vote: I like it 0 Vote: I do not like it
I have a little question about a challenge case in problem A of today's contest. In my room one coder wrote a subroutine where he checked for every address whether it matches with the "input" string. In order to do that, he run a for loop which checked character by character whether the "input" string matches with any of the addresses. His for loop runs like this:

for ( int i = 0 ; i < input.size() ; i ++ ) {
if(input[i]!=current_address[i]) break;
}

Now my question, shouldn't there be a runtime error when the size of the input is bigger than the current_address, given all the other characters are equal?

I challenged it and it failed. Can anyone explain why?
  • 14 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it
    what data type of input && current_address?
    As I know a[big_int] will return 0 if it is string

    upd:
    I tried this code in g++:
    string a("abcde");
    cout<<(int)a[17];

    It prints 0
    • 14 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      Wouldn't there be an exception?
      • 14 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it
        No any exceptions,errors.
        Just 0
        • 14 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it
          You are wrong, as far as my tests tell.
          • 14 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it
            Can you show me code you are tried?
            And.. language?
            • 14 years ago, # ^ |
              Rev. 2   Vote: I like it 0 Vote: I do not like it
              No problem. I used C++ and string. (as I suppose this is what is used in the solution shown above, though I am not sure).

              So I tried the following:

              int main()
              {
                  string str = "codeforces";
                  cout << str[11] << endl;
                  return 0;
              }

              It banged, crashed, exploded. Still, I agree that if current_address is char[], then the code will not crash and everything will go smoothly, exactly because of the '\0' character you spoke of.
              • 14 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it
                do you use MS Visual C++?
                I tried this code:
                #include <string>
                #include <iostream>
                using namespace std;
                int main()
                {
                    string str = "codeforces";
                    cout << str[12] << endl;
                    return 0;
                }
                it runs successful on my computer(g++) and in tab "Run" on codeforces (g++) but crashed in MS C++
              • 14 years ago, # ^ |
                  Vote: I like it +5 Vote: I do not like it
                But '\0' is at str[10], not at str[11]. isnt it?
                • 14 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it
                  You are correct, now as I changed the index it really runs smoothly. Cool I did not know that.
  • 14 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    Can you point to this solution?
  • 14 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    Hm, if it is char[],first symbol after End of String will 0 too
14 years ago, # |
  Vote: I like it 0 Vote: I do not like it
so, those who are not in div2, were not allowed to open any solution? or it was a problem here? I just wanted to see some people's code (no intention was for hacking :P) but it didn't allow me to do so...
  • 14 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it
    you can see and hack solution in your own room( This room consist of users from your division only)
14 years ago, # |
  Vote: I like it +12 Vote: I do not like it
+83   and blue  :D , All effect of "rng"  thanx rng_58.
14 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Do we get tutorial for this contest?
14 years ago, # |
  Vote: I like it 0 Vote: I do not like it

In problem B test 7,  the input is 99 100 and the answer is 80 64. But what if the answer is 64 80? My program told me the latter answer and I think it's more reasonable--people would usually like to cut pictures as consistent with the origin ratio as possible, wouldn't they?

  • 14 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it
    Read carefully problem statements. Tiebreaker is maximal height. Only statements is source of logic in programming contests.
    • 14 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      Yes you're right. I didn't notice it.