Hi
My Code Gives write answer too all test cases that i have tested.
but it gives run time error on some test cases. I tries to find the reason but i couldn't.
please help me. i use 2 Floyd-Warshal s to solve it
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
using ...
Search found 98 matches
- Fri Sep 05, 2008 8:13 pm
- Forum: Volume 108 (10800-10899)
- Topic: 10816 - Travel in Desert
- Replies: 49
- Views: 29644
- Sat Aug 09, 2008 5:20 am
- Forum: Volume 114 (11400-11499)
- Topic: 11480 - Jimmy's Balls
- Replies: 12
- Views: 6970
Re: 11480 - Jimmy's Balls
i think the answer for n is round((n-3)^2/12)
if it's spoiler tell me to delete it?
if it's spoiler tell me to delete it?
- Mon Aug 04, 2008 6:25 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11475 - Extend to Palindrome
- Replies: 32
- Views: 20500
Re: 11475 - Extend to Palindromes
@baodog:
Your code prints an extra unprintable character at the end of each line on my machine. But it looks otherwise ok.
@hamedv:
I'm curious about the O(n^2) DP you mentioned. The simple brute force way of solving this problem is also O(n^2). Could you please post an outline of your idea?
I ...
Your code prints an extra unprintable character at the end of each line on my machine. But it looks otherwise ok.
@hamedv:
I'm curious about the O(n^2) DP you mentioned. The simple brute force way of solving this problem is also O(n^2). Could you please post an outline of your idea?
I ...
- Mon Aug 04, 2008 6:20 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11472 - Beautiful Numbers
- Replies: 13
- Views: 6019
Re: 11472 - Beautiful Numbers
I keep track of used numbers so far a the first dimension of an array. The other 2 dimensions are length and the last digit. For example 5 (101) means that I used numbers (0 and 2). When I find answers for each length I iterate through (111) values for each length and every digit to the left of the ...
- Mon Aug 04, 2008 5:19 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11472 - Beautiful Numbers
- Replies: 13
- Views: 6019
Re: 11472 - Beautiful Numbers
Try these:
input:
correct output:
replace this line
by this:
input:
Code: Select all
1
5 100
Code: Select all
778091614
Code: Select all
tabl[i][j]+=fun(i,j,k)
Code: Select all
tabl[i][j]=(tabl[i][j]+fun(i,j,k))%1000000007;
- Mon Aug 04, 2008 8:30 am
- Forum: Volume 114 (11400-11499)
- Topic: 11472 - Beautiful Numbers
- Replies: 13
- Views: 6019
Re: 11472 - Beautiful Numbers
if (LASTDIGIT = 0 ans DIGITS = 1)
----------- mydpfunction(BASE, DIGITS, LASTDIGIT) = 0;
IMHO the problem may be here. Don't assume, that the number 0 can't be used in DIGITS > 1. Since the number 10 is produced by adding 1 to zero.
Once you have found the answer of a particular length. You ...
- Sun Aug 03, 2008 8:39 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11472 - Beautiful Numbers
- Replies: 13
- Views: 6019
Re: 11472 - Beautiful Numbers
yes you are right but can you tell me why i'm getting WA:
mydpfunction(BASE, DIGITS, LASTDIGIT) = number of the beautiful numbers in base BASE which have DIGITS digits and their last digit is LASTDIGIT.
if (LASTDIGIT = 0 and DIGITS = 1)
----------- mydpfunction(BASE, DIGITS, LASTDIGIT) = 0;
if ...
mydpfunction(BASE, DIGITS, LASTDIGIT) = number of the beautiful numbers in base BASE which have DIGITS digits and their last digit is LASTDIGIT.
if (LASTDIGIT = 0 and DIGITS = 1)
----------- mydpfunction(BASE, DIGITS, LASTDIGIT) = 0;
if ...
- Sun Aug 03, 2008 6:23 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11475 - Extend to Palindrome
- Replies: 32
- Views: 20500
Re: 11475 - Extend to Palindromes
Yes, i don't know too
There were problems like this an i solved them using DP, because the input size was less than 1000 but in this problem it's so huge.
There were problems like this an i solved them using DP, because the input size was less than 1000 but in this problem it's so huge.
- Sun Aug 03, 2008 6:19 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11472 - Beautiful Numbers
- Replies: 13
- Views: 6019
11472 - Beautiful Numbers
i think it's a simple DP problem but i'm getting WA :(
here is my code:
#include <iostream>
using namespace std;
int main()
{
long long dp[11][101][10];
memset(dp, 0, sizeof dp);
for (int i = 0; i < 11; i++)
for (int j = 0; j < 10; j++)
if (j)
dp[i][1][j] = 1;
else
dp[i][1][j] = 0;
for ...
here is my code:
#include <iostream>
using namespace std;
int main()
{
long long dp[11][101][10];
memset(dp, 0, sizeof dp);
for (int i = 0; i < 11; i++)
for (int j = 0; j < 10; j++)
if (j)
dp[i][1][j] = 1;
else
dp[i][1][j] = 0;
for ...
- Sun Aug 03, 2008 8:49 am
- Forum: Bugs and suggestions
- Topic: 724 - Reverse
- Replies: 3
- Views: 2265
Re: 724 - Reverse
but i think the correct code is this:
Code: Select all
Code deleted by moderator.
- Sun Aug 03, 2008 8:46 am
- Forum: Bugs and suggestions
- Topic: 724 - Reverse
- Replies: 3
- Views: 2265
Re: 724 - Reverse
Yeah i submited this code and got ac !!!
main(){}
main(){}
- Wed Jun 25, 2008 10:37 am
- Forum: Volume 105 (10500-10599)
- Topic: 10583 - Ubiquitous Religions
- Replies: 33
- Views: 20352
Re: 10583 - Ubiquitous Religions
Hi
I'm getting WA but i don't know why does my code fail?
I have checked it with many I/O from this site: http://uvatoolkit.com/
Please give me an input that my code gives wrong answer to it?
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <sstream ...
I'm getting WA but i don't know why does my code fail?
I have checked it with many I/O from this site: http://uvatoolkit.com/
Please give me an input that my code gives wrong answer to it?
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <sstream ...
- Fri Apr 18, 2008 10:45 am
- Forum: Volume 104 (10400-10499)
- Topic: 10483 - The Sum Equals the Product
- Replies: 21
- Views: 13158
Re: 10483 - Why WA ???
Hi
I don't know why my code produces 352 triples. It also produced 352 triples after I changed my code as you said in previous posts. Please tell me which triples am i missing?
Here is my code:
I don't know why my code produces 352 triples. It also produced 352 triples after I changed my code as you said in previous posts. Please tell me which triples am i missing?
Here is my code:
Code: Select all
Thank you, Jan
- Sat Jan 26, 2008 12:14 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11392 - Binary*3 Type Multiple
- Replies: 14
- Views: 6916
- Sat Jan 19, 2008 1:53 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11392 - Binary*3 Type Multiple
- Replies: 14
- Views: 6916