| Show all threads Hide all threads Show all messages Hide all messages |
| One hint against WA | Oleg Strekalovsky [Vologda SPU] | 1274. Fractional Arithmetic | 28 Nov 2010 22:12 | 9 |
After my wrong AC tests were added (Thanks to Fyodor Menshikov). Many authors lost AC.The problem was with division to negative divisors. (Example) 1/2 / -1/3 Good luck! I have WA #30, but on your test and on same tests my solution give right answers. Can be there others tricks? Try these tests: INPUT: 30000 29999/30000 * 30000 29999/30000 OUTPUT: 900059998 899940001/900000000 INPUT: 30000 29997/30000 / 1/29999 OUTPUT: 899999996 1/10000 Edited by author 05.05.2009 04:36 Thanks! You helped me a lot. Yes, I see. But I achieved the target - helped to the guys to find their bugs and get AC =) My program passed these tests, but it still has WA#29. (Before rejudge it has AC status). Does anybody have other hints or tests? OUCH! But on test 30000 29999/30000 * -30000 29999/30000 my prog outputs -20745377/900000000 instead of -900059998 899940001/900000000 hmm... thank you for good tests, Vedernikoff Sergey :) Now it's OK, just stupid mistake with labs function I saw with a help of this test. I don't know why it works wrong with long long numbers. I'll not use it anymore! Edited by author 06.03.2010 01:05 Edited by author 06.03.2010 01:06 thanks, first i WA#26 but when i see your test got AC, thanks, i dont forgot your help in all my life ;) sorry for my poor english. |
| I WA on 1st test!!!WHY?! | zhuaiyaa | 1077. Travelling Tours | 28 Nov 2010 18:02 | 1 |
My answer for the sample is 3 3 1 4 2 3 2 3 4 4 1 3 4 2 or 3 3 1 4 2 4 1 3 4 2 3 2 3 4 Can anyone give me the 1st test? |
| why WA#1? | ile | 1077. Travelling Tours | 28 Nov 2010 17:00 | 3 |
I have no idea what's wrong... I am using DFS (something like euler-cycle detection); checking for self-loop edges; output format is right, tho it returns little bit different for sample test: 3 3 1 2 4 4 1 2 4 3 3 2 4 3 Please, any ideas about wa#1? oh, i forgot to add that i am doing dfs for every connected component separately! Edited by author 15.06.2010 03:05 I did that too,my answer is completely the same as yours,and I WA on the 1st test too |
| give me the ideas of solution please | Ilya Filippov (Petrozavodsk SU) | 1486. Equal Squares | 28 Nov 2010 08:30 | 2 |
if you are a chinese , you can read the article —— Hash在信息学竞赛中的一类应用 |
| No subject | Nathalie | 1800. Murphy's Law | 28 Nov 2010 01:29 | 1 |
Edited by author 28.08.2011 02:03 |
| Can anyone tell me how to solve this problem? | Marko Tintor (marko@pkj.co.yu) | 1173. Lazy Snail | 27 Nov 2010 23:58 | 2 |
|
| why I got WA? | qwt | 1173. Lazy Snail | 27 Nov 2010 23:57 | 3 |
var a:array[0..1000,1..3] of real; x,y,x0,y0:real; n,i,j,k:integer; begin readln(x0,y0); readln(n); fillchar(a,sizeof(A),0); for i:=1 to n do begin readln(x,y,a[i,3]); x:=x-x0;y:=y-y0; a[i,1]:=x;a[i,2]:=y; end; for i:=1 to n-1 do for j:=i+1 to n do if a[i,1]*a[j,2]-a[i,2]*a[j,1] >0 then begin a[0]:=a[i];a[i]:=a[j];a[j]:=a[0]; end; writeln(0); for i:=1 to n do begin writeln(a[i,3]:0:0); end; writeln(0); end. Edited by author 27.11.2010 23:57 Edited by author 27.11.2010 23:58 |
| It doesn'e need convexhull. Sorting is enough! | shrek | 1173. Lazy Snail | 27 Nov 2010 23:56 | 4 |
Yeah... Came back to this problem when realized that myself :) I had solved problem by building O(N) convex hulls and then unifying them up from the deepest. How to solve it with only sort? Give me some hints please how to use convexhull in O(n), when the input have arbitary order, "skorKNURE" or any person plz help and explain this algo to me? sorry for my poor englis. GOOD LUCK!!! |
| if you have MLE | Ibragim Ismailov (TNU) | 1198. Jobbery | 27 Nov 2010 23:20 | 2 |
if you have MLE just change all int's to short's :) i use short and got AC in 0.453s && 15788kb and when i change adjacent list to "adjacent matrix" i Ac in 0.359s and 8044kb. sorry for my poor english. |
| Admins the description of the problem is wrong ! | Fechete Dan Ionut[dany] | 1188. Library | 27 Nov 2010 18:43 | 4 |
i got wa on test 7 my answer 3 9 oficial answer 3 5 3 5 can be optain only if we move(not remove or op 6) the two pegs of shelf nr 8 and cut 2 from the plank none of the 6 op alows us to do so. Am I wrong? Where did you get the test data? Could you send me a copy? thx a lllllllllllllot mountainshanyi@gmail.com i also wa7 but my answer is 3 7 |
| i use O(n^4), :( | hoan | 1172. Ship Routes | 27 Nov 2010 00:22 | 1 |
i use O(n^4) and got AC in .062 s, if you have a better algo, plz explain to me, plz ,plz, plz .... sorry for my poor english. GOOD LUCK!!! |
| Just BFS | Pavel Kovalenko | 1463. Happiness to People! | 26 Nov 2010 12:19 | 1 |
Just BFS Pavel Kovalenko 26 Nov 2010 12:19 No DP! Just 2 BFS for each connected component. |
| Why it returns wrong and said my solution is stack overflow | zhuaiyaa | 1035. Cross-stitch | 26 Nov 2010 11:37 | 3 |
I was completely mad of it! (By the way ,my English is poor.) And what is the 16th test? Can anyone give me a test? Apreciated much. I finally AC,I use BFS at last,DFS will return stack overflow |
| Crash 4: without Replace(...) | Orel ~(ONU)~ | 1020. Rope | 26 Nov 2010 03:55 | 1 |
Can anyone help me? This is my code wich has Crash on the 4th test: using System; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Collections; using System.Collections.Generic; using System.Text; using System.IO; using System.Globalization; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo; String[] str = Console.ReadLine().Split(new char[] { ' ', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries); int n = int.Parse(str[0], nfi); int r = int.Parse(str[1], nfi); double length = 0; if (n == 1) { length += r * Math.PI * 2; Console.Write(String.Format(nfi, "{0:F2}", length)); return; } double[][] mat = new double[n][]; for (int i = 0; i < n; i++) mat[i] = new double[2]; for (int i = 0; i < n; i++) { String[] str1 = Console.ReadLine().Split(new char[] { ' ', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries); mat[i][0] = Double.Parse(str1[0], nfi); mat[i][1] = Double.Parse(str1[1], nfi); } for (int i = 0; i < n; i++) { if (i == n - 1) { length += Math.Sqrt((mat[i][0] - mat[0][0]) * (mat[i][0] - mat[0][0]) + (mat[i][1] - mat[0][1]) * (mat[i][1] - mat[0][1])); break; } length += Math.Sqrt((mat[i][0] - mat[i + 1][0]) * (mat[i][0] - mat[i + 1][0]) + (mat[i][1] - mat[i + 1][1]) * (mat[i][1] - mat[i + 1][1])); } length += r * Math.PI * 2; Console.Write(String.Format(nfi, "{0:F2}", length)); } } } |
| DP solution | MSDN | 1183. Brackets Sequence | 26 Nov 2010 00:00 | 3 |
S - it is a line Create a matrix F[i][j] is a decision with i on j a symbol If S[i] it is a closing bracket, F[i][j] =1 + F[i+1][j] If S[i] a closing bracket that is two cases: 1) We add a closing bracket - 1 + min(F[i+1][k] + F[k+1][j]), where i<k<=j 2) Is in line closing - min(F[i+1][k-1], F[k+1][j]), where S[k] = S[i] and i<k<=j Interesting... But what you output? Please explain to me > 1) We add a closing bracket - 1 + min(F[i+1][k] + F[k+1][j]), where i<k<=j if we want to add a bracket we can add it in (i+1)position. and dont necessary too check all the kind. sorry for my poor english. GOOD LUCK!!! |
| CE | lisang | | 25 Nov 2010 23:45 | 1 |
CE lisang 25 Nov 2010 23:45 |
| WA #11 | Lifanov | 1806. Mobile Telegraphs | 25 Nov 2010 21:40 | 3 |
WA #11 Lifanov 11 Nov 2010 16:41 Please Help me, i get WA #11 many times. My solution in Java 1) For each "phone number" get list neighbours 2) use PriorityQueue to find shortest path 3) print path For calculations with "phone number" use Long for init max_time use 10^12 I can send my solution on mail. Sorry for my english. Re: WA #11 Ibragim Atadjanov (Tashkent U of IT) 12 Nov 2010 11:03 You can send it to atush_1988@mail.ru I've got ac in java Got the same problem using c++((( Help sombody, please! |
| which MST algo do you prefer | tiancaihb | 1160. Network | 25 Nov 2010 21:14 | 6 |
I think, that this problem can be solved without MST. Just use binary search by maximum of single cable length and check accessibility of every node of graph. NlogM :) I like Kruskal's algo, as it is easy to implement it using disjoint set systems with O(n*logn) running time. |
| HELP | Levan | 1001. Reverse Root | 25 Nov 2010 20:37 | 1 |
HELP Levan 25 Nov 2010 20:37 Why wrong answer??? #include <iostream> #include <cmath> #include <sstream> #include <vector> #include <iomanip> using namespace std; int main() { double ans; string s; vector <double> vect; int i; i=0; while(cin>>s){ stringstream ss; ss<<s; ss>>ans; vect.push_back(sqrt(ans));
} for(int i=vect.size();i>=0;i--) cout<<setprecision(5)<<vect[i]<<endl; return 0; } |
| AC coad .wa many times only because the input do not say which node is father | mcdoing_ron | 1018. Binary Apple Tree | 25 Nov 2010 17:16 | 2 |
#include<iostream> using namespace std; const int maxn=105; int count[maxn]; int g[maxn][maxn]; int n;int q; int cost[maxn][maxn]; int f[maxn][maxn]; int visit[maxn]; void init( ) { cin>>n>>q; for(int i=1;i<n;i++) { int a,b,c; scanf("%d %d %d",&a,&b,&c); g[a][++count[a]]=b; cost[a][b]=c; g[b][++count[b]]=a; cost[b][a]=c; } //memset(f,-10000,sizeof(f)); } void dfs(int x) { visit[x]=1; if(count[x]==0) {
return ; } for(int i=1;i<=count[x];i++) { int child=g[x][i]; if(visit[child]==0){ dfs(child); for(int j=q;j>=0;j--) for(int k=q-j-1;k>=0;k--) { f[x][k+j+1]=max(f[child][k]+f[x][j]+cost[x][child],f[x][k+j+1]);
} } } } void print( ) { cout<<f[1][q]<<endl; } int main( ) { freopen("in.txt","r",stdin); init( ); dfs(1); print( ); return 0; } Please explain your solution. Thanks |