389 - PE

The forum to report every bug you find or tell us what you'd like to find in UVa OJ

Moderator: Board moderators

Locked
daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

389 - PE

Post by daveon » Fri Dec 29, 2006 5:10 am

My code outputs the following:

Code: Select all

ANSWER1\n
ANSWER2\n
ANSWER3\n
But I keep on getting PEs???

Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
Location: Calgary, Canada

Post by Darko » Fri Dec 29, 2006 9:08 am

I'm not sure, that one seems to be OK - do you print "ERROR" or " ERROR"?

daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

Post by daveon » Fri Dec 29, 2006 4:49 pm

Well, I used

Code: Select all

cout << "  ERROR" << endl;

daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

Post by daveon » Fri Jan 05, 2007 4:25 am

Nevermind, I recoded it in C and got ACC.

User avatar
Carlos
System administrator
Posts: 1286
Joined: Sat Oct 13, 2001 2:00 am
Location: Valladolid, Spain
Contact:

Post by Carlos » Fri Jan 05, 2007 7:22 pm

Not nevermind!! Please, tell me the number of submission so that I can check it. Or send me the program.
DON'T PM ME --> For any doubt, suggestion or error reporting, please use the "Contact us" form in the web.

thurbo
New poster
Posts: 9
Joined: Wed Apr 05, 2006 2:00 pm
Location: Stockholm, Sweden

389 PE

Post by thurbo » Tue Jan 09, 2007 11:02 pm

Going through my PE programs and I have PE for this problem as well.
Using C++/STL, I thought that maybe setw in combination with string could be a problem but the following gives PE too:

Code: Select all

struct Solution {
	string number;

	friend ostream& operator<<(ostream& strm, const Solution& solution) {
		if ( solution.number.length() > DIGITS )
			strm << "  ERROR";
		else if ( solution.number.length() == DIGITS )
			strm << solution.number;
		else
			strm << setw(DIGITS - solution.number.length()) << ' ' << solution.number;

		return strm;
	}
};
Newline characters are written in main:

Code: Select all

void main(void) {
	transform(istream_iterator<Problem>(cin), istream_iterator<Problem>(), ostream_iterator<Solution>(cout, "\n"), ProblemSolver());
}
The only thing I can think of is empty newlines in the input...

daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

Post by daveon » Sat Jan 13, 2007 5:45 pm

Perhaps I am using incorrect code to output.

The PE code:

Code: Select all

if(error) cout << "  ERROR" << endl;
else      cout << setw(7) << temp << endl;
The AC code:

Code: Select all

if(error) printf("  ERROR\n");
else      printf("%7s\n",temp);

User avatar
Carlos
System administrator
Posts: 1286
Joined: Sat Oct 13, 2001 2:00 am
Location: Valladolid, Spain
Contact:

Post by Carlos » Tue Jan 30, 2007 11:55 pm

Maybe it's the compilers problem. setw might not be well implemented....that will be solved when upgrading the compiler (new system again).

I've checked judge's output and I couldn't find anything wrong.

We'll leave this for now.
DON'T PM ME --> For any doubt, suggestion or error reporting, please use the "Contact us" form in the web.

Locked

Return to “Bugs and suggestions”