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

Автор _iris_, 11 лет назад, По-английски

i get presentation error on test 11 on problem 304 sgu(http://acm.sgu.ru/problem.php?contest=0&problem=304) my biggest problem is i dont know what pe exactly is !! can anyone help ?? this is my code http://paste.ubuntu.com/6489024/

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

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

PE means that the output doesn't follow the format. For example, you don't output anything or output "-1" instead of "Impossible" or vice-versa. For this task, you can for example, output 3 on first line, then != 3 numbers on the second.

UPD. Looked in your code, in the task you shold output the indeces of teeth, but in the loop you can output "-1"

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

    ok thanks the -1 is because i wanted to get WA if the problem was with the loop but its still PE :| (i mean at first i submitted the code without the if statement in the loop and it had pe i dont realy know what the problem is but any how thanks :) )

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

In most of judging systems PE means your output is fine but you don't print it the right way, this usually happens when you print some extra spaces or new-lines, or you don't print them when they are needed. also nic11 mentioned that extra output and similar mistakes can cause this error.

If you have noticed, Codeforces always suggests to use cin or cout or %I64d instead of %lld if you are using a 64-bit variable, they might also be the case for this error.

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

As the others says ... Presentation Error means you don't follow the rules of problem for white spaces ( include newlines and spaces ).

In your solution you print one space after each number instead of splitting them with spaces for simplifying,but you have an extra space at the line of numbers which coz presentation error in most judges (codeforces doesn't have PE).

If you add this small change in your code it will be accepted.


bool first=true; for(int i=0;i<nn;i++){ for(int j=0;j<n;j++){ if(a[j][0]==ans[i][0]&&a[j][1]==ans[i][1]&&use[j]==false){ if(first)first=0; else cout<<" "; cout<<j+1; use[j]=true; break; } if(j==n-1) cout<<-1; } }