Search found 15 matches

by Ruslan Shevelyov
Thu Jul 07, 2005 9:30 pm
Forum: Volume 1 (100-199)
Topic: 184 - Laser Lines
Replies: 15
Views: 3892

if (flag2 == 0)
pts[n].x = x; pts[n].y = y; n++;
Probably should be if (flag2 == 0){
pts[n].x = x; pts[n].y = y; n++;
}
BTW, GCD is unnecessary. In fact, it is not obvious to me that this algorithm is correct. I used another: #include <list>
#include <vector>
#include <utility>
using namespace ...
by Ruslan Shevelyov
Wed Jul 06, 2005 2:51 pm
Forum: Volume 1 (100-199)
Topic: 184 - Laser Lines
Replies: 15
Views: 3892

1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 3 3 0 0
0 0
Your program's output: The following lines were found:
( 1, 1)( 1, 2)( 1, 3)
( 1, 1)( 2, 1)( 3, 1)
( 1, 1)( 2, 2)( 3, 3)
( 1, 3)( 2, 2)( 3, 1)
Correct output: The following lines were found:
( 1, 1)( 1, 2)( 1, 3)
( 1, 1)( 2, 1)( 3, 1)
( 1, 1)( 2, 2)( 3 ...
by Ruslan Shevelyov
Sat Jan 03, 2004 9:39 am
Forum: Volume 1 (100-199)
Topic: 103 - Stacking Boxes
Replies: 200
Views: 50442

Babelfish's English is much better than mine.
by Ruslan Shevelyov
Thu Jan 01, 2004 5:09 pm
Forum: Volume 1 (100-199)
Topic: 103 - Stacking Boxes
Replies: 200
Views: 50442

Сгенерил полмиллиона тестов, ошибок не нашёл...
by Ruslan Shevelyov
Sat Aug 16, 2003 6:56 am
Forum: Volume 1 (100-199)
Topic: 199 - Partial differential equations
Replies: 15
Views: 6516

I understood what was wrong with the code I was going to post; the reason is: I #include d a.h and then attempted to use some functions/classes from b.h which is included from a.h in all implementations on which I could test my program (but not in gcc), so I assumed it'll work everywhere.

Thanks ...
by Ruslan Shevelyov
Fri Aug 15, 2003 4:51 am
Forum: Java
Topic: Anyone who use Java?
Replies: 3
Views: 1390

Re: Anyone who use Java?

Zhao Le, take a look at this thread.
by Ruslan Shevelyov
Fri Aug 15, 2003 4:47 am
Forum: Volume 1 (100-199)
Topic: 199 - Partial differential equations
Replies: 15
Views: 6516

So could you sum up what is the problem?
OJ's C++ compiler cannot compile many programs which I think it should, since other ANSI C++ compilers which I tried can (Borland C++ 5.5, ANSI mode; Comeau C++ 4.3.3 BETA at http://www.comeaucomputing.com/tryitout/, C++ mode strict, no -tused). If anyone ...
by Ruslan Shevelyov
Thu Aug 14, 2003 7:17 am
Forum: Volume 1 (100-199)
Topic: 112 - Tree Summing
Replies: 137
Views: 32389

Re: 112 - help me. plz

I tested your program with random data; some tests for which your program produced wrong results are:
8(8(2(1()())())())
8(8(3(7()())())())
4(4(2(4()())())())
5(5(4()(1(7(3()())(4()()))(4(3()())())))())
21(7()(5()(5()(4(1(7()())())()))))
47(7(9()(1(4()(7()(5(9(3(4(10()())())())(5(9(5(6(3(1(9()(2(3 ...
by Ruslan Shevelyov
Mon Aug 11, 2003 6:22 am
Forum: Other words
Topic: (Autotester) If you keep getting WA
Replies: 0
Views: 796

(Autotester) If you keep getting WA

...and decided to post your code and ask for more test inputs/outputs, you will probably find this thing useful:
[cpp]
#include <cstdlib>
#include <fstream>
#include <iostream>
using namespace std;
class Autotester{
public:
virtual void generate_test(ofstream&) = 0;
virtual void run_test ...
by Ruslan Shevelyov
Mon Aug 11, 2003 6:20 am
Forum: Volume 1 (100-199)
Topic: 103 - Stacking Boxes
Replies: 200
Views: 50442

Re: 103 Stacking Boxes. Appeal to everyone who can help.

My old Pascal compiler said he don't know what "fillchar" is, and I already forgot the syntax... So I said #define fillchar(ARR, SIZE, VALUE) for ___idx:=1 to SIZE do ARR[___idx]:=VALUE; <evil grin> don't know if it is correct or not...
So he compiled the code, and for this test:

17 4
859 397 577 ...
by Ruslan Shevelyov
Mon Aug 11, 2003 6:18 am
Forum: Volume 1 (100-199)
Topic: 103 - Stacking Boxes
Replies: 200
Views: 50442

Re: 103 - WA (i'm going crazy!) need test inputs!

danielrocha ,

Your program gave strange output for this test (run for a minute or so):

6 5
622 413 899 408 333
471 304 534 644 914
11 529 348 268 542
581 374 527 557 669
888 397 159 70 722
373 303 788 71 255


1
1
1
1
1
1
1
1
2
55 100
1
1
2
4 1
1
1
2
501 128
1
1
1
1
2
279 277
1
1
2
516 388
1
1 ...
by Ruslan Shevelyov
Mon Aug 11, 2003 6:17 am
Forum: Volume 1 (100-199)
Topic: 103 - Stacking Boxes
Replies: 200
Views: 50442

George ,

I wrote this simple autotester:
[cpp]
#include <cstdlib>
#include <fstream>
#include <iostream>
using namespace std;

void gen_test(){
int dim = rand()%3+1;
int num = rand()%5+1;
fstream testfile("in", ios_base::out);
testfile<<num<<' '<<dim<<'\n';
for(int i=0; i<num; i++){
for(int ...
by Ruslan Shevelyov
Mon Aug 11, 2003 6:14 am
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 108923

Those char act1[4],act2[4] look suspiciously. Looks like you forgot to reserve space for trailing zero.
On my machine your program just leaves these boxes as is.
by Ruslan Shevelyov
Sat Aug 09, 2003 9:56 am
Forum: Volume 1 (100-199)
Topic: 199 - Partial differential equations
Replies: 15
Views: 6516

I apologize for posting complete solution for problem 101; hope no one will get really angry, since the problem is trivial.

After receiveing that "implicit declaration of function int find(...)" I removed
[cpp]
#include <algorithm>
using std::find;
using std::for_each;
[/cpp]
from my program and ...
by Ruslan Shevelyov
Fri Aug 08, 2003 8:19 pm
Forum: Volume 1 (100-199)
Topic: 199 - Partial differential equations
Replies: 15
Views: 6516

STL: weird compile errors (Resolved)

First of all, sorry for my English.

I keep getting weird compile errors for my programs which Borland C++ 5.5 compiles with no single warning. For example (199 Partial Differential Equations):
[cpp]
#include <algorithm>
#include <iostream>
#include <valarray>
#include <numeric>
using namespace std ...

Go to advanced search