_iris_'s blog

By _iris_, 10 years ago, In English

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/

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
10 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

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"

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

    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 :) )

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

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.

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

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; } }