Блог пользователя adhoc_king

Автор adhoc_king, история, 7 лет назад, По-английски

I couldn't find a blog post about Round 1C. So let's discuss the solutions! :)

  • Проголосовать: нравится
  • +40
  • Проголосовать: не нравится

»
7 лет назад, скрыть # |
 
Проголосовать: нравится -7 Проголосовать: не нравится

Auto comment: topic has been updated by adhoc_king (previous revision, new revision, compare).

»
7 лет назад, скрыть # |
Rev. 4  
Проголосовать: нравится 0 Проголосовать: не нравится

At the end of the contest my submissions for problem "Power Arrangers" were being checked for quite long time and were getting TLE verdict. But I am sure that my latest solutions work in the given time limit(they do approximately $$$50*5*5!=30000$$$ operations, which should certainly fit in the time limit, also it works OK on my computer). Can it be some technical issue? Has anyone else had similiar issues?

UPD: As Adhami told, my solution was wrong and should get WA. But because I didn't handle 'N' I got TLE.

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +30 Проголосовать: не нравится

Solving easy — 20 min
Solving hard — 20 min
Solving med — 20 min
Figuring out how tf do I use these stupid interactive runnners and testers and noting that judge returns "Y" or "N", not "1" and "0" — 30 min

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +49 Проголосовать: не нравится

I must say I was very excited when I first read problem 2: "interactive problem, answer chosen uniformly at random? Must be some clever and cool elegant solution!".

Then I noticed that 119 + 23 + 5 + 1 < 150.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

I got TLE in B because I was reading F for each testcase, maybe that helps some of you

»
7 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

Bonjour everyone! ;(

Can someone please help me with the first problem :(

I got a WA but i am missing some corner case maybe.

My solution is similar to the one in editorial.

Thanks in advance!

Code = https://ideone.com/hq1PC9

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    So I am ruling out 2 cases before creating the string and they are:

    1: When the count of unique characters in an index i for all the strings is not 1 for any index then answer is impossible. 2: If this index whose count is 1 (first 1 we get) occurs after an index with 3 different characters then answer is again impossible.

    Now other than this, i will iterate till the first 1 and create string accordingly (mp2 in my code) and for the last 1 (mp1 is used in my code)

    s'il vous plaît! :(

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Do they still publish official analysis after the round? I can't find it anywhere!!

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Are there statistics for this round?

»
7 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

In the second problem. Inputs & outputs are huge. I don't have any idea about this except typing 148 numbers from my solution to the running test_tool.py and type the result back by hand. Any way easier?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone explain the solution for the 2nd subtask of last problem?

I have read the analysis but didn't get the part where they tell that our problem gets divided into 2 sub-problems?

Can someone please explain that or any other approach?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone explain the solution of Problem 1(Robot Programming Strategy).

I have done exactly mentioned in analysis. First stored all the program of other robots in vector . Then accessed i-th character of all robot and put it in a set. Then I have checked for 3 cases.

If set size is 3 (R,P,S) it mean there cannot be any solution with our program can win.

If size of set is 1 it means that iteration only have 1 value and we can choose corresponding winning value and return the solution

If size of set is 2 then choose the stronger character (like "R" in "RS") and proceed till we get size of set 3 or 1 , or our program length reaches 500 .

Here is my solution https://ideone.com/KJ8ovE It would be so grateful if anyone can help me debugging the solution.I have tried downloading working solution of other and tried random test cases but it is working fine.

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I didn't read the code fully but this might be one possible mistake, suppose you defeated player 1 in the first move then you don't need to include its other characters in the subsequent moves. If you include it then you might get all the characters (PRS) at some position which would result in a false impossible result.

    • »
      »
      »
      7 лет назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      Actually he does not include them.

      for (int i = 0; i < a; i++) {
       
          // Here.
          if(skip.find(i) != skip.end())
              continue;
       
          if (idx < robot[i].length()) {
            ch.insert(robot[i][idx]);
          } else {
            ch.insert(robot[i][idx % robot[i].length()]);
          }
        }
      
    • »
      »
      »
      7 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +6 Проголосовать: не нравится

      Damn me. Got my mistake. The mistake is in conversion of array of character into string.

      set ch;
      char curr[501];
      int i = 0;
      for (auto xx : ch) {
      curr[i++] = xx;
      }
      //curr[i] = ‘\0’; Missed to introduce this terminater.
      string cur(curr);
      

      Learning : We should always take care of basics.