10125 - Sumsets

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

Moderator: Board moderators

Samleo
New poster
Posts: 11
Joined: Mon Dec 03, 2012 2:39 pm

Re: 10125 - Sumsets

Post by Samleo »

brianfry713 wrote:That code won't compile
Huh? Why?
It works perfectly on my c++ compiler and uva is returning me WA, not CE
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10125 - Sumsets

Post by brianfry713 »

Input:

Code: Select all

5
21
31
36
37
39
8
0
1
2
3
21
31
36
38
16
0
3
8
12
13
14
16
18
23
24
25
26
27
28
31
32
15
2
3
5
7
10
11
13
14
15
19
22
36
37
38
39
15
0
1
3
5
10
12
14
18
21
23
26
28
30
37
38
14
9
10
12
13
16
19
23
25
27
28
29
30
31
34
13
1
4
8
10
12
16
18
21
24
31
34
36
38
8
6
9
16
29
31
33
34
38
11
2
4
5
10
12
14
16
18
24
25
36
3
3
5
36
0
AC output:

Code: Select all

no solution
38
32
39
38
34
38
31
36
no solution
Check input and AC output for thousands of problems on uDebug!
Ty4
New poster
Posts: 7
Joined: Sun Jan 19, 2014 1:58 am

Re: 10125 - Sumsets

Post by Ty4 »

/Removed after AC
Last edited by Ty4 on Tue Jan 21, 2014 3:43 am, edited 1 time in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10125 - Sumsets

Post by brianfry713 »

Input:

Code: Select all

4
1
2
-3
0
0
AC output: 0
Check input and AC output for thousands of problems on uDebug!
Ty4
New poster
Posts: 7
Joined: Sun Jan 19, 2014 1:58 am

Re: 10125 - Sumsets

Post by Ty4 »

Awesome, that did it. Thank you!
carofe82
New poster
Posts: 3
Joined: Thu Oct 22, 2015 7:11 am

Re: 10125 - Sumsets

Post by carofe82 »

The brute force algo won't pass in Java. The O(n^2 log(n)) does and it is the best algorithm.
Post Reply

Return to “Volume 101 (10100-10199)”