Page 1 of 1

12282 - OmniGravity

Posted: Thu Jun 14, 2012 8:01 pm
by forthright48
In the problem statement, it said "There is a blank line before every case." But in the sample, there is no space before the first case? Which one should I follow. In addition, I tried submitting in both ways, but I am getting WA.

Code: Select all

Got AC. :D

Re: 12282 - OmniGravity

Posted: Thu Jun 14, 2012 9:28 pm
by brianfry713
Don't read from a file.

Re: 12282 - OmniGravity

Posted: Thu Jun 14, 2012 9:30 pm
by brianfry713
In my AC code I read the input using scanf("%s"), so it didn't matter if there was a blank line in the input or not.

Re: 12282 - OmniGravity

Posted: Thu Jun 14, 2012 9:31 pm
by mubashwir
Though its not a good case but still it proves your code wrong....check it out.......:p
  • 1
    .#..AA..
    .##.AA#.
    ........
    .CCBB...
    .CCBB#..
    #.......
    ..DD....
    ..DD....
your output
  • Case 1: 2315
ans is :
  • Case 1: 2314

Re: 12282 - OmniGravity

Posted: Thu Jun 14, 2012 9:39 pm
by mubashwir
you can try this... this may help you....

Code: Select all

1
.#..AA..
.##.AA#.
..#.#.#.
.CCBB..#
.CCBB#..
##...#.#
#.DD..#.
.#DD....
your ans is :

Code: Select all

Case 1: 13
my ans is :

Code: Select all

Case 1: 12

Re: 12282 - OmniGravity

Posted: Thu Jun 14, 2012 10:12 pm
by forthright48
@brianfry713: Thanks. I used scanf to avoid the blank line problem.

@mubashwir: Thanks vaia. After seeing your test cases I realized the statement asked for "number of different static states that can be reached from the original position by enabling at least one gravity". Initially the gravity is off. So sometimes the initial state given may not be static. I simply removed two lines and got AC :D