Page 2 of 2

Posted: Mon Sep 06, 2004 10:57 am
by Ghust_omega
Thanks !!! Minilek this i/o was very useful , with this i see where is wrong, and I got AC, but P.E. :( my I/O is almost the same as yours only for one '\n' and i dont figure out how can avoid the P.E. please someone that helps
Thanks in advance
Keep posting!!! :)

Posted: Sun Dec 26, 2004 7:51 am
by CodeMaker
:D HI , I got P.E. at first then I printed a newline after each test case including the last one and got Acc..... :-?

Posted: Mon Sep 11, 2006 11:30 pm
by phoenix7
I think my program should not get WA! I've yours about what the output should be. and I've tried to fix it but still, I get WA. can anyone read my code please.

Code: Select all

#include <cmath>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <string>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <algorithm>
using namespace std;
#define show(x)			cout << #x << " = " << x << endl
#define FOR(i, n)		for(int i = 0; i < n; i ++)


int main() {
	#ifndef ONLINE_JUDGE
	freopen("PopulationExplosion.in", "r", stdin);
	#endif

	char buf[100];

	int t;
	cin >> t;
	int tt = 0;
	while(t --) {
		//show(tt);
		if(tt ++)
			cout << endl;

		int y;
		cin >> y;
		cin.getline(buf, 100);

		char b[20][20];

		FOR(i, 20)
			FOR(j, 20)
				b[i][j] = ' ';

		while(cin.getline(buf, 100), buf[0]) {
			string line = buf;
			istringstream iss(line);
			//show(line);

			int r, c;
			iss >> r >> c;
			b[r-1][c-1] = 'o';
		}

		FOR(k, y) {
			cout << "*******************" << endl;

			char next[20][20];
			FOR(i, 20)
				FOR(j, 20)
					next[i][j] = ' ';

			FOR(i, 20) {
				FOR(j, 20)
					cout << b[i][j];
				cout << endl;
			}

			FOR(i, 20) {
				FOR(j, 20) {
					int nb = 0;
					for(int ii = i-1; ii <= i+1; ii ++)
						for(int jj = j-1; jj <= j+1; jj ++) {
							if(!(ii == i && jj == j) && ii >= 0 && ii < 20 && jj >= 0 && jj < 20 && b[ii][jj] == 'o')
								nb ++;
						}

					if(b[i][j] == ' ' && nb == 3)
						next[i][j] = 'o';
					else if(b[i][j] == 'o' && (nb < 2 || nb > 3))
						next[i][j] = ' ';
					else
						next[i][j] = b[i][j];
				}
			}

			FOR(i, 20)
				FOR(j, 20)
					b[i][j] = next[i][j];
		}
		cout << "*******************" << endl;
	}

	return 0;
}

P.E.??

Posted: Fri Mar 23, 2007 6:25 pm
by TimeString
Ghust_omega wrote:Thanks !!! Minilek this i/o was very useful , with this i see where is wrong, and I got AC, but P.E. :( my I/O is almost the same as yours only for one '\n' and i dont figure out how can avoid the P.E. please someone that helps
Thanks in advance
Keep posting!!! :)
Hey, be careful the day it gives might be 0, which should only print a line contains 20 '*'.
And, don't delete spaces after the last 'O'. After I change this condition, I got ACc.

P.S. I don't print a blank line after the last case.

WHY PE in 447 please help....

Posted: Wed Apr 11, 2007 10:00 pm
by shakil
please please help..............

Code: Select all


Cut after AC


Posted: Wed Apr 11, 2007 10:20 pm
by Jan
Search your problem first. Don't open a new thread if there is one already. This problem already has many threads.

Posted: Fri Apr 13, 2007 10:14 am
by shakil
Jan , can you expline why i don't open a new thread if there is one already , what's the problem. Thanks for your help.

Posted: Fri Apr 13, 2007 10:27 am
by Jan
Read the description about any volume. For volume 1...
All about problems in Volume I. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Because if there are many threads for a single problem, it would be harder to find useful information from the threads. See the threads in volume 1. There are 31 pages, did you ever check page 31? why?
For some problems there are more than 30 threads for each. If you need a desired information you have to check all of them.

That's why there should be one thread for one problem.

Posted: Sat Apr 14, 2007 10:12 am
by shakil
Thanks Jan, for your expline. I shall try to maintain your opinion.