| Show all threads Hide all threads Show all messages Hide all messages |
| WA5 can sb give me some hints? | format_jam | 1539. Intelligence Data | 19 Aug 2008 05:48 | 6 |
WA5 can sb give me some hints? wa5 again and again The same problem I can't find mistake:( try this test 1 4 1.0 2.1 3.2 4.5 the right answer is 10 thank you so much !!!!!!!!!! I finally find the problem. I use function round first.But it has bug! e.g. round(3.5)=3(<>4) round(3.6)=4 p.s. I use pascal. thx again Test 5 Брэнд 20 Mar 2008 23:27 First. Is requied number more than 0? Second. Please, give me several tests for correction my program (I don't use round-up and my code pass all tests of this forum). Obviously it's positive, otherwise division is not well defined. Also, my algo would always output 0 if I allow it to test this value :) |
| Problem 1331 "Vladislava" has been rejudged (+) | Sandro (USU) | 1331. Vladislava | 19 Aug 2008 04:21 | 6 |
61 submits lost AC verdict (many because of tricky 12 test). Try to find a bug in your source code. Good luck! P.S. Thanks to Alias (Alexander Prudaev) for idea of new tests. I have get AC again, but problem with test#3 is keep open -0.00 != 0.00 Edited by author 08.04.2007 11:42 Problem with "-0.00" has been resolved yesterday. But your WA3-program outputs "1.#R". Edited by author 08.04.2007 13:01 I have send my program on your e-mail what is mean ? 1.#J 1.#R ??? Can be result of sqrt(-1) or acos(5), etc... |
| Autors, TL in Java... | HonoraryCoder | 1600. Airport | 19 Aug 2008 04:13 | 3 |
I have o(n * n) algorithm, not many calculations inside cycle, but still TLE12. Imho, everybody writes such a solutions, but in c++ in can be accepted in 0.015, but i have 1.031 (or more) in java. That's not fairly. I ask autors to increase TL up to 2 seconds, or maybe change your time checking system to prevent this... I have ACepted this problem in 0.234 using Java without any optimizations. I have 0.234 in C++ with simple O(N^2) algo. Square roots are slow even in C++. |
| Why WA5 | Beksinski | 1600. Airport | 19 Aug 2008 04:12 | 2 |
My program passed the tests, published in this thread, but it couldn't passed test 5. What is in this test? Edited by author 05.03.2008 20:18 I had it when I checked solutions only for zero discriminant (while should've for any non-negative). If that was your bug too..... :))))))))))) |
| Precision question | Samsonov Alex [USU] | 1371. Cargo Agency | 19 Aug 2008 03:56 | 13 |
What precision should we use in output? Could I have WA#17 because of it? Is double (long double) enough for us? with a precision of 4 decimal digits. double is always enough for calculatings on Timus. Then it (4 digits) should be written in russian statement. Fixed. (-) Vladimir Yakovlev (USU) 17 Sep 2005 00:29 To avoid precision problems it is possible to use only integer numbers in solving this task, but I have the same WA#17. Do you use int64? Check it. (50 000 * 50 000 = 2 500 000 000) Yes, of cause, I use unsigned __int64. I tried double, __in64 and long double and still WA17. That must be some other bug... Maybe problem with the following code: for ( i = 1; i <= m_N; ++i ) for ( j = 1; j <= m_N; ++j ) sum += t[ i ][ j ]; sum /= N * (N - 1); It must be obviously changed to ... for ( i = 1; i <= m_N; ++i ) for ( j = 1; j <= m_N; ++j ) sum += t[ i ][ j ]) / ( N * (N - 1)); overflow ... Maybe it will be usefull :- ) And again I've tried both variants... Still WA17 Why both variants! First fragment implyies WA ( it`s obvious ) Did you convert N to __int64 ? It was noted that N*N > signed int. Hmmm ... Send me your code ( see e-mail in my profile ) Yes. The bug what in these data types. I think I should love __int64 from this task and further. Thank you very much! I got AC. I used __int64 (signed) to get total sum of all paths. Then I casted it to double before division by n*(n-1)/2. Got WA41. That happened because 'n' was 'int' and that multiplication overflowed. Then I casted 'n' to 'int64' inside that multiplication and got AC. |
| Can anybody please tell me how to greedy this prob? | Maigo Akisame (maigoakisame@yahoo.com.cn) | 1092. Transversal | 19 Aug 2008 02:50 | 3 |
Put all + signs onto main diagonal (except for the last row). Then you have to (optionally) flip main diagonal and reduce double + in columns towards single + in the last column. |
| Possibly to solve with greedy algo even now | Vedernikoff Sergey | 1092. Transversal | 19 Aug 2008 02:48 | 2 |
Even after anti-greedy tests were added, it is possibly to solve the problem with greedy algo. Just randomize directions in which you make "greedy walk" of the incidence matrix. The best thing is that it is impossible to kill such an algo with any anti-greesy tests! =) I have proven greedy solution (with O(N^3) output size) |
| I got wa#1..Do anybody has some tests? | double | 1092. Transversal | 19 Aug 2008 02:47 | 2 |
I had WA when I output non-permutation for the sample test |
| Compiler hints: if you're going to use complex numbers in C++ | Anisimov Dmitry | 1621. Definite Integral | 18 Aug 2008 21:14 | 1 |
#include <complex> using namespace std; complex<double> X; |
| How to solve this problem? | Al.Cash | 1621. Definite Integral | 18 Aug 2008 21:13 | 2 |
I've found a simple formula for this integral, but it uses p1, q1, p2, q2 such that P(x)= a4 ( x^2 + p1 · x + q1) · ( x^2 + p2 · x + q2). These values are always real, but I don't know how to find them. Maybe there is a solution which doesn't use them? Of course there is. 1). Use Ferrari method to find roots. 2). Use numerical method to find roots. 3). Use generic numerical methods without finding roots. All are not-so-easy to implement. |
| There is something wrong with the Check Program, | TJU_HighRP | 1625. Hankel Matrix | 18 Aug 2008 16:22 | 3 |
In the problem description we know that all output should be positive integers.But I submit a solution which contains '0' but it got accepted.I think the Check Program has something wrong. Statement isn't fully updated: Output positive integers α1, α2, …, α2n−1 ... But they must be only non-negative! |
| WA 10 | LSBG | 1626. Interfering Segment | 18 Aug 2008 14:37 | 1 |
WA 10 LSBG 18 Aug 2008 14:37 Anyone with a an idea for a test that can fix this? |
| "i got Ac use 0.02s" i used this solution but in JAVA | KUM | 1118. Nontrivial Numbers | 18 Aug 2008 14:33 | 3 |
public static void main(String[] args){ Scanner in = new Scanner(System.in); int k,ans=0,start,stop; double r; boolean p;
start=in.nextInt(); stop=in.nextInt(); r=2147483647; if (start==1) System.out.println(1); else {
for (int i=stop; i>=start; i-- ){ p=true; for (int j=2; j<=Math.round(Math.sqrt(i)); j++) { if ((i % j)==0) { p=false; break; } } if (p) { ans=i; r=1/i; break; } }
for (int i=stop; i>=start; i--){ if (Math.abs(Math.sqrt(i)-Math.round(Math.sqrt(i)))<(1e-8)) { if (r>(1+Math.sqrt(i))/i) ans=i; break; } } if (ans!=0) { System.out.println(ans); } else { for (int i=start; i<=stop; i++){ k=1; for (int j=2; j<=Math.round(Math.sqrt(i)); j++) { if ((i % j)==0) { k+=(j+(i / j)); if (j==(i / j)) k-=j; } if (r>(k/i)) { ans=i; r=k/i; } }
} System.out.println(ans); } } } Where is my mistake& Edited by author 25.03.2008 18:19 Edited by author 18.08.2008 14:34 |
| C++ Input handling (end of input, that is) | Mihail Minkov | 1414. Astronomical Database | 17 Aug 2008 23:52 | 4 |
Hi, i'm having problems with the input of this task. How does my program know when the input is over? It would be very helpful if you could give me a code sample (only the input, not the actual task :) ). Something like: #what libraries the input needs while(way to know the input is over) { way_to_read (scanf, cin ...something else?) } Thanks, I believe if i get this part, the rest will work first time :) char s[1000]; while (scanf("%s", s) != EOF) { .... } Edited by author 19.09.2007 21:04 read faq Vladimir Yakovlev (USU) 20 Sep 2007 15:55 while(scanf("%s", s) == 1) Edited by author 17.08.2008 23:53 |
| solution 4C# | dzhob | 1020. Rope | 17 Aug 2008 21:59 | 4 |
Edited by author 13.03.2008 12:29 using System; namespace _1020 { class Class1 { [STAThread] static void Main(string[] args) { string s = Console.ReadLine(); s = s.Replace('.',','); string[] w = s.Split(' '); int n = int.Parse(w[0]); double r = double.Parse(w[1]); double[,] k = new double[n,2]; for(int i = 0; i < n; i++) { string s1 = Console.ReadLine(); s1 = s1.Replace('.',','); string[] w1 = s1.Split(' '); k[i,0] = double.Parse(w1[0]); k[i,1] = double.Parse(w1[1]); } double sum = 0; for(int i = 0; i < n - 1; i++) sum += Math.Sqrt((k[i,0] - k[i + 1,0])*(k[i,0] - k[i + 1,0]) + (k[i,1] - k[i + 1,1])*(k[i,1] - k[i + 1,1])); sum += Math.Sqrt((k[0,0] - k[n - 1,0])*(k[0,0] - k[n - 1,0]) + (k[0,1] - k[n - 1,1])*(k[0,1] - k[n - 1,1])); sum += 2*Math.PI*r; sum += 0.005; string h = sum.ToString(); h = h.Replace(',','.'); int x = h.IndexOf('.'); h = h.Insert(x+3, "r"); string[] v = h.Split('r'); Console.WriteLine(v[0]); } } } |
| J | Tjrac_MysTic | 1627. Join | 17 Aug 2008 19:27 | 2 |
J Tjrac_MysTic 17 Aug 2008 14:13 like 1 1 . when there is one room,output what? Re: J Yermak 17 Aug 2008 19:27 There is one way to join all bedrooms! :) So you must output 1. |
| Minor hints and clarifications | Denis Koshman | 1357. Teakettle 1.0 for Dummies | 17 Aug 2008 18:59 | 1 |
1. Precision of 1e-10 seconds is enough to compare boil-time with wake-time. 2. If some guy wakes up at the same time the water is ready (I mean exact equality up to precision), the water is disposed to cups first. So he will fill up an empty tank in this case. 3. Output times after rounding them UP. It is not quite clear from problem statement, but it's the closest guess if we assume that drinking can start only at integer number of seconds. At least this approach gives AC. 4. Output rounded times modulo 24:00:00 (i.e. if cup is ready the next day, subtract 24 from HH). |
| I have got WA on test2 | SoSimple | 1619. Big Brother | 17 Aug 2008 18:44 | 2 |
Can you tell me the 2nd test Write inefficient (but correct) solution and you will be able to generate tests yourself. |
| output format | Shiplu | 1619. Big Brother | 17 Aug 2008 18:42 | 2 |
I am new here, so i am not understanding the output format of this problem ( how many digit after the decimal point). could anyone please tell me about this........... Edited by author 17.08.2008 16:38 Use printf("%.6lf\n",value); in C See FAQ, there's an entry about that. |
| What's my solution problem? | SabaRG | 1619. Big Brother | 17 Aug 2008 16:29 | 2 |
#include <iostream> using namespace std; int main() { int n,k,m; cin>>n; while(n) { cin>>k>>m; if(!k && !m) cout<<"1\n"; else if(k<m) cout<<"0\n"; else cout<<(float)k/(k+m)<<endl; n--; } return 0; } Edited by author 17.08.2008 15:09 I have the same problem #include <iostream> using namespace std; struct money { double alex,bob;}; money a[2005]; int n; void solve (int p) { float q; if (a[p].alex==a[p].bob) q=1/(1+a[p].alex); // else if (a[p].bob>a[p].alex) q=0; else q=a[p].alex/(a[p].bob+a[p].alex); cout<<q<<endl;} int main () { cin>>n; for (int i=0;i<n;i++) cin>>a[i].alex>>a[i].bob; for (int i=0;i<n;i++) solve (i); return 0; } Where am I wrong? Edited by author 17.08.2008 16:54 |