Search found 112 matches

by epsilon0
Sun Feb 02, 2003 11:53 am
Forum: Volume 1 (100-199)
Topic: 111 - History Grading
Replies: 135
Views: 21983

give up, the judge is wrong. just look at the second input test in the problem. it's wrong. i solved it this morning and i'm sure my program is correct but it doesn't get accepted. here is the source code if you still care: [c]#include <stdio.h> #include <stdlib.h> #define MAX 20 char answers[MAX], ...
by epsilon0
Sun Feb 02, 2003 10:06 am
Forum: Volume 1 (100-199)
Topic: 110 - Meta-Loopless Sorts
Replies: 92
Views: 7716

of course, "else if" is not a keyword. it's exactly the same as C/C++, each else is in relation with the closest if that is not already in relation with an else. example: if a then if b then c else d else e the first else is related to the second if and the second else to the first if. remove the "t...
by epsilon0
Sat Feb 01, 2003 12:25 pm
Forum: Volume 1 (100-199)
Topic: 109 - SCUD Busters
Replies: 96
Views: 24422

109 SCUD Busters & 137 Polygons

these geometrical algorithmic problems are too complicated for me, i'm afraid! even the simple problem of finding the intersection of 2 segments (which is like solving a set of 2 equations with 2 unkowns) is too hard for me :/ you gotta take take of special cases where the coefficients are zero, etc...
by epsilon0
Fri Jan 31, 2003 4:39 pm
Forum: Volume 1 (100-199)
Topic: 110 - Meta-Loopless Sorts
Replies: 92
Views: 7716

chinaluoqi your program is very good, you just need to read this:
http://acm.uva.es/problemset/minput.html
to make multiple input work.

just add a cin >> n; in start of your prog and it will work.

nghiank what do you mean ???
by epsilon0
Thu Jan 30, 2003 6:20 pm
Forum: Volume 1 (100-199)
Topic: 116 - Unidirectional TSP
Replies: 226
Views: 35887

i got accepted on first try. this problem is easy!

do you take care of the lexicographic order?
by epsilon0
Thu Jan 30, 2003 2:18 pm
Forum: Volume 1 (100-199)
Topic: 110 - Meta-Loopless Sorts
Replies: 92
Views: 7716

Ivan Golubev is right about multiple input. read the page about multiple input format! i just solved this problem and i thought it was hard! until i found a simple recursion to do it. btw is anyone able to compile the pascal program from n = 8? it almost stuck my box. 20000+ lines of if/then/else !!...
by epsilon0
Thu Jan 30, 2003 9:44 am
Forum: Bugs and suggestions
Topic: 511 - Do You Know the Way to San Jose? - Do nothing AC
Replies: 62
Views: 4970

i just solved this problem this morning. it's easy. take it easy and use functions. don't write everything in the main(). this is unreadable, and people can't help you. my basic algo is: if letter X goes before letter Y, matrix[x][Y] = 1 you then have a graph, and wish to find the longer path in it....
by epsilon0
Thu Jan 30, 2003 9:20 am
Forum: General
Topic: SECURITY FLAW IN ONLINE JUDGE
Replies: 34
Views: 8489

SECURITY FLAW IN ONLINE JUDGE

I've discovered a security flaw that lets a malicious hacker with lots of time on her hands to gain knowledge of Online Judge's input on any problem in the sets. The procedure goes like this: we can safely assume the input of a problem is a string of ASCII characters, and terminates with either a sp...
by epsilon0
Wed Jan 29, 2003 7:36 am
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 22541

actually my solution goes like:

loop i from 1 to n
+ loop ii from i to n
+ + loop k from 1 to n
+ + + solve an O(1) problem
+ + solve an O(n) problem

so the complexity would be n(n+1)/2 * (n * 1 + n)
so n^3 + n^2
by epsilon0
Tue Jan 28, 2003 2:09 pm
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 22541

ok i solved it in O(n^3) (or so i think) i found the 0(n) solution for the 1 dim problem and then worked from there. it ran in 0.031 second on judge's PC. it would be more like O(n^3 + n) actually (which is about the same anyway) my concern is about the O(n^3) part, i'm not totally convinced of it's...
by epsilon0
Tue Jan 28, 2003 11:19 am
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 22541

108 maximum sum

this problem drove me mad for 24 hours.

:cry:

i don't see the O(n^3) solution...

i'll try to code a naive algorithm but i'm sure it will be too slow.

please explain me how it can be solved faster.

the same problem in one dimension (ie a matrix 1xN) has an O(n^2) solution? or better?

HELP
by epsilon0
Mon Jan 27, 2003 1:40 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 181946

the problem 100 is very fallacious. my program was accepted, yet it did not work. explanation: some of the intermediate results are greater than 2^32 thus using the C type "unsigned int" or any equivalent is WRONG. this could lead to wrong results if the judge had chosed the input test data in a vic...
by epsilon0
Mon Jan 27, 2003 1:30 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 181946

programming guidelines: no function longer than ten lines clean identation try it out! in case your program was properly indented, use the C function of this board to post it so people can read it! example: [c]int main(int argc, char **argv) { init(); solve(); clean(); return EXIT_SUCCESS; } [/c]
by epsilon0
Mon Jan 27, 2003 1:01 pm
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 38184

if ((op & 1) == 0) ReturnAll (posB, ordB + 1); if ((op & 2) == 0) ReturnAll (posA, ordA + 1); see, this works. your error was lack of parenthesis. because it seems '==' has a higher precedence priority than '&' so 1 == 0 was evaluated to 0 and then op & 0 was always 0 of course. so both tests were a...
by epsilon0
Mon Jan 27, 2003 12:55 pm
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 38184

if (!(op%2))
ReturnAll (posB, ordB + 1);
if (op<2)
ReturnAll (posA, ordA + 1);

i changed this and recompiled and now it works... dunno what was wrong with your '&' tests...

Go to advanced search