Search found 10 matches

by lucastan
Thu Jun 19, 2014 8:44 am
Forum: Volume 9 (900-999)
Topic: 932 - Checking the N-Queens Problem
Replies: 18
Views: 11219

Re: 932 - Checking the N-Queens Problem

Hi all, I'm pretty sure I got this right but I keep getting WA.. any hint?

#include<iostream>
#include<cstring>
using namespace std;
int row[100];
int col[100];
int d1[100];
int d2[100];
int board[35][35];
int n;

inline void set(int i, int j){row[i]=col[j]=d1[i+j]=d2[i-j+31]=1;}
inline void clear ...
by lucastan
Fri May 17, 2013 10:22 am
Forum: Other words
Topic: Command line tool for the UVa Online Judge website
Replies: 3
Views: 5599

Re: Command line tool for the UVa Online Judge website

Hi, thanks for all your support.

I have updated with new features:
•Remembers your account info and encrypts your passwords.
•Password-less submissions.
•Checks most recent submission status.
•Template Support!
•File name completion and problem number detection *new*
•Non-interactive mode *new ...
by lucastan
Sat Apr 20, 2013 9:39 am
Forum: Other words
Topic: Command line tool for the UVa Online Judge website
Replies: 3
Views: 5599

Command line tool for the UVa Online Judge website

Command line tool for the UVa Online Judge website

I made this tool for myself and want to share with everybody!

UVA-NODE is an interactive shell where you can type commands to submit and check your submissions.

Features

Remembers your account info and encrypts your passwords.
Password-less ...
by lucastan
Mon Aug 29, 2011 7:34 am
Forum: Volume 113 (11300-11399)
Topic: 11367 - Full Tank?
Replies: 13
Views: 11051

Re: 11367 - Full tank?

anyone can explain why the sample output for the first case is 170 ?

Thanks!
by lucastan
Tue Aug 23, 2011 6:29 am
Forum: Volume 112 (11200-11299)
Topic: 11228 - Transportation system.
Replies: 30
Views: 18909

Re: 11228 - Transportation System

I generated all edges for all pairs of cities and then used Kruskal + Union Find (with path compression and ranking)
The union find is less than 10 lines of code
Kruskal done using make_heap and pop_heap

I got WA once because I didn't realize # of states == # of railroads + 1 ........
but why is ...
by lucastan
Thu Aug 18, 2011 5:24 am
Forum: Volume 110 (11000-11099)
Topic: 11094 - Continents
Replies: 43
Views: 28218

Re: 11094 - Continents

Gotchas:
- M is the # of rows! N is # of columns
'x' refers to the row index!


- Can be any chars other than l and w

- The grid wraps around at column 0 and column N-1

- Only up, down, left and right are considered adjacent

- Look for largest land area except the initial one the King's on ...
by lucastan
Fri Aug 12, 2011 5:31 pm
Forum: Volume 103 (10300-10399)
Topic: 10337 - Flight Planner
Replies: 20
Views: 12603

Re: 10337 - Flight Planner

I would say this problem is confusing and ambiguous.

It is straightforward but not very well explained.

Say if the input is

1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
1 9 9 1
1 -9 -9 1

Let row 0 be the bottommost (altitude 0) (1 -9 -9 1)
Let column 0 be the left most column ...
by lucastan
Mon Aug 01, 2011 3:03 am
Forum: Volume 114 (11400-11499)
Topic: 11459 - Snakes and Ladders
Replies: 33
Views: 21410

Re: 11459 - Snakes and Ladders

the biggest trick is that the input is formatted nicely for you already ...

Be very careful of the meaning of mouth/tail of snake.

The input is specified as X, Y where X is bottom of ladder or mouth of snake (Entrance)
Y is top of ladder or tail of snake (Exit)

Also terminate ASAP when a player ...
by lucastan
Wed Jul 27, 2011 5:04 pm
Forum: Volume 114 (11400-11499)
Topic: 11413 - Fill the Containers
Replies: 13
Views: 10077

Re: 11413 - Fill the Containers

Try this:

5 3
1 2 3 4 8
3 2
4 78 9

Your solution gives an incorrect answer of 6 whereas it should be 8
I think you're close. Just have to fix this bug
by lucastan
Fri Jul 22, 2011 1:39 am
Forum: Volume 103 (10300-10399)
Topic: 10309 - Turn the Lights Off
Replies: 19
Views: 12670

Re: 10309 - Turn the Lights Off

* Theory:
* The minimal solution consists of a sequence of moves.
* Think of these moves as a series of XOR operations .. (m1 XOR m2 XOR m3 ...) = BOARD_CLEAR
* The usual associativity and XOR-the-same-thing-cancels-out properties
* still apply.
* So no two move should be on the same cell ...

Go to advanced search