844 - Pousse

All about problems in Volume 8. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

844 - Pousse

Post by helloneo »

Hello..~
Can anybody see anything wrong..?
I'm getting WAs..

Code: Select all

code removed
Last edited by helloneo on Sun Dec 03, 2006 3:00 pm, edited 1 time in total.
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

I think you haven't understood the problem properly. The problem states
all markers on the insertion row or column from the insertion square upto the first empty square are moved one square further to make room for the inserted marker

Code: Select all

Suppose after playing a while you get the following state
  _______________ 
 |   |   |   |   |
 |   |   | O |   |
 |___|___|___|___|
 |   |   |   |   |
 | O | O | X |   |
 |___|___|___|___|
 |   |   |   |   |
 |   |   | X |   |
 |___|___|___|___|
 |   |   |   |   |
 |   |   | X |   |
 |___|___|___|___|

 Now if player 'X' uses move 'L2'
  _______________ 
 |   |   |   |   |
 |   |   | O |   |
 |___|___|___|___|
 |   |   |   |   |
 | X | O | O | X |
 |___|___|___|___|
 |   |   |   |   |
 |   |   | X |   |
 |___|___|___|___|
 |   |   |   |   |
 |   |   | X |   |
 |___|___|___|___|

 Now if player 'O' uses move 'T3'
  _______________ 
 |   |   |   |   |
 |   |   | O |   |
 |___|___|___|___|
 |   |   |   |   |
 | X | O | O | X |
 |___|___|___|___|
 |   |   |   |   |
 |   |   | O |   |
 |___|___|___|___|
 |   |   |   |   |
 |   |   | X |   |
 |___|___|___|___|

 Now if player 'X' uses move 'L2'
  _______________ 
 |   |   |   |   |
 |   |   | O |   |
 |___|___|___|___|
 |   |   |   |   |
 | X | X | O | O |
 |___|___|___|___|
 |   |   |   |   |
 |   |   | O |   |
 |___|___|___|___|
 |   |   |   |   |
 |   |   | X |   |
 |___|___|___|___|

 Now if player 'O' uses move 'T3'
  _______________ 
 |   |   |   |   |
 |   |   | O |   |
 |___|___|___|___|
 |   |   |   |   |
 | X | O | O | X |
 |___|___|___|___|
 |   |   |   |   |
 |   |   | O |   |
 |___|___|___|___|
 |   |   |   |   |
 |   |   | O |   |
 |___|___|___|___|

 And at this stage 'O' has one straight, but 'X' has none. So, 'O' Wins.
Hope it helps.
Ami ekhono shopno dekhi...
HomePage
helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Post by helloneo »

AC..
Thanks a lot :-)
metaphysis
Experienced poster
Posts: 139
Joined: Wed May 18, 2011 3:04 pm

Re: 844 - Pousse

Post by metaphysis »

Test data generator.

Code: Select all

#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
    srand(time(NULL));
    int cases = 100;
    cout << cases << "\n\n";
    
    for (int cs = 1; cs <= cases; cs++)
    {
        if (cs > 1) cout << '\n';
        int N = rand() % 101;
        cout << N << '\n';
        string push = "LRTB";
        for (int i = 1; i <= 100 && N; i++)
        {
            cout << push[rand() % 4];
            cout << rand() % N + 1;
            cout << '\n';
        }
        cout << "QUIT\n";
    }

    return 0;
}
Post Reply

Return to “Volume 8 (800-899)”