Search found 76 matches

by dibery
Mon Feb 19, 2018 5:50 am
Forum: General
Topic: Why CE? UVa 575
Replies: 2
Views: 1382

Re: Why CE? UVa 575

Submit as C++11.
The C++ option does not support gets().
BTW, you should be able to read to compilation error message in your submission page.
by dibery
Thu Feb 23, 2017 10:57 am
Forum: Volume 123 (12300-12399)
Topic: 12321 - Gas Stations
Replies: 3
Views: 1792

Re: 12321 - Gas Stations

This problem is very similar to 10020.
If you get accepted on that problem, the same code can be used here with little modification.
by dibery
Thu Jun 23, 2016 3:39 pm
Forum: Volume 103 (10300-10399)
Topic: 10343 - Base64 Decoding
Replies: 20
Views: 7717

Re: 10343 - Base64 Decoding

Getting PE. Please help me. My idea is as follows: 1. Use input() function to get input from stream. 2. Treat 4 chars from input each time. 3. Convert into index. 4. Calculate the value of the output. Note. If I delete the puts( "" ) on line 36, I get a WA. Thanks. #include<iostream> #include<cstrin...
by dibery
Sat Jun 11, 2016 6:55 pm
Forum: Volume 15 (1500-1599)
Topic: 1597 - Searching the Web
Replies: 1
Views: 856

Re: 1597 - Searching the Web

Getting several PE but don't know what the problem is. My idea is pretty simple. For each query, iterate through all articles and all lines. Print that line if it contains that query word. The idea works fine, as I got a PE, not WA. But the problem is why PE. I didn't find the point where I'm missin...
by dibery
Wed Apr 20, 2016 5:06 am
Forum: Volume 130 (13000-13099)
Topic: 13084 - Cameras as Invigilators
Replies: 0
Views: 1491

13084 - Cameras as Invigilators

Getting several WA for this problem. I've tried many solutions but none worked. Here's my solution: (spoiler below) 1. Generate all lines that can be drawn in 5001x5001 grid. (As the longest line is 5000x5000, I didn't generate lines longer than 5000.) 2. For each possible line (sorted in order), ch...
by dibery
Thu Apr 14, 2016 7:18 am
Forum: Volume 130 (13000-13099)
Topic: 13086 - Pirates of the Mega Ocean
Replies: 0
Views: 947

13086 - Pirates of the Mega Ocean

Some explanation for this problem. In case there's anyone who's also confused with this problem. 1. There are N islands in total, M of which are small. 2. S_i means the ID of small island. In the following case, 4 2 0 1 1 2 1 4 There are 4 islands, 2 normal, 2 small ones. Population is [ 2, 3, 4, 5 ...
by dibery
Fri Feb 05, 2016 9:33 am
Forum: Volume 122 (12200-12299)
Topic: 12207 - That is Your Queue
Replies: 4
Views: 4638

Re: 12207 - That is Your Queue

One more case.

Input:

Code: Select all

100000000 6
N
E 1
E 1
N
N
N
0 0
Output:

Code: Select all

Case 1:
1
1
2
3
by dibery
Thu Jan 07, 2016 7:07 pm
Forum: Volume 130 (13000-13099)
Topic: 13039 - Fibonacci Triangle
Replies: 1
Views: 691

Re: 13039 - Fibonacci Triangle

OK, I figured it out, and I'll explain a little bit more in details. 1. For input "1 6 2", we have sticks of lengths of "2 3 3 3 3 3 3 5 5", 9 sticks in total. 2. We have to make as many triangles as possible. 3. Each triangle consists of 3 sticks, and no stick should be used more than once. So for ...
by dibery
Wed Dec 30, 2015 7:54 pm
Forum: Volume 129 (12900-12999)
Topic: 12911 - Subset sum
Replies: 4
Views: 5902

Re: 12911 - Subset sum

Hi , I am using Meet In The Middle Technique for this Problem Got AC But Time > 2s ... I see some other solution takes ~.1 sec.. What algorithm is needed to get such execution time ?? My solution ran about 0.113 sec. You may refer to https://en.wikipedia.org/wiki/Subset_sum_problem Spoiler below: I...
by dibery
Wed Dec 30, 2015 7:36 pm
Forum: Volume 129 (12900-12999)
Topic: 12911 - Subset sum
Replies: 4
Views: 5902

Re: 12911 - Subset sum

Zyaad Jaunnoo wrote:What is the output for this input?

Code: Select all

40 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
On uDebug, the output is:

Code: Select all

1099511627775
Shouldn't it be?

Code: Select all

40
Every element is considered different.
by dibery
Wed Dec 30, 2015 9:15 am
Forum: Volume 130 (13000-13099)
Topic: 13039 - Fibonacci Triangle
Replies: 1
Views: 691

13039 - Fibonacci Triangle

Didn't quite understand this problem.
Should all sticks be used?

In the first sample input, 1 6 2
Does it mean "2 3 3 3 3 3 3 5 5" cm sticks?
I found
3 3 2
5 5 3
5 5 2
3 3 5, 4 possible combinations.
Why the answer is 3?

Thanks.
by dibery
Tue Oct 20, 2015 2:48 pm
Forum: Volume 115 (11500-11599)
Topic: 11579 - Triangle Trouble
Replies: 20
Views: 9959

Re: 11579 - Triangle Trouble

One critical input, hope it helps someone.
Input:

Code: Select all

1
6 2.10 1.99 1.39 9.07 2.29 2.00
Output:

Code: Select all

1.95
by dibery
Tue Oct 13, 2015 1:09 pm
Forum: Volume 4 (400-499)
Topic: 462 - Bridge Hand Evaluator
Replies: 32
Views: 9770

Re: 462 - Bridge Hand Evaluator

Your code fails on these 2 cases. (Your code returns clubs on both cases.)

QC JC AH KH QH JH 3D 4D 5D 6D 7S 8S QS
---bid heart

QC JC AH KH QH JH 3D 4D 5D 6D 7S 8S JS
---pass
by dibery
Sat Sep 12, 2015 2:44 pm
Forum: Volume 117 (11700-11799)
Topic: 11747 - Heavy Cycle Edges
Replies: 11
Views: 3928

Re: 11747 - Heavy Cycle Edges

Input: (blank lines between cases for readability) 2 0 6 7 1 5 6 3 0 5 2 3 4 4 0 3 2 4 2 3 4 1 3 5 0 4 5 1 3 4 1 2 3 1 0 2 3 2 1 0 3 0 6 5 1 0 4 5 2 3 3 0 2 4 0 1 5 1 0 5 2 1 4 1 0 2 0 8 5 2 4 4 7 5 3 3 7 2 7 6 1 2 6 0 2 0 3 0 4 1 2 1 0 9 20 2 1 19 6 2 18 5 2 17 2 7 16 7 4 15 2 3 14 5 7 13 6 5 12 0 ...
by dibery
Fri Aug 21, 2015 7:35 pm
Forum: Volume 115 (11500-11599)
Topic: 11504 - Dominos
Replies: 55
Views: 20256

Re: 11504 - Dominos

Got runtime error. Please help me, thanks. My approach is tarjan's algorithm. (SCC) Then count the number of SCC whose in-degree is 0. I ran through thousands of cases on my computer, but none crashed. Got AC. The reason of RE was stack overflow. I created 100,000 vectors and int arrays. Though decl...

Go to advanced search