|
|
Общий форум[code deleted] ------------------------------------------------------------------------------------- I've got AC. If you wa on test#3 , you should wirte your OWN suffix array base on your UNDERSTANDING cause it's too easy . If you want my help , just send me an e-mail . adress : ngziming@gmail.com . ------------------------------------------------------------------------------------- pleased try this data input: 5 CCCCC CCCCC output: CCCCC ------------------------------------------------------------------------------------- hint: remeber to add a no-use char at the last of the string . ------------------------------------------------------------------------------------- Edited by author 16.08.2012 09:29 var a: integer; b: longint; begin readln(a); b := (a + 1) * (abs(a - 1) + 1) div 2; writeln(b); end. can you tell me how to avoid using a STL map in my sqrt-decomposition No problem. My solution gets no TLE but I also use sqrt-decomposition. Perhaps problem is in other matter. sqrt-decomposition - AC in 0.421 and 7 177 memory :) It’s Runtime error in case#10 who can tell me Why? 第10组Re为什么? why my progam get it??? I think its correct z wrote many tests and all of them my program pass corectly but in test 2 some strange... I know that N in 2 test = 2 if it test from statement? please give me some tests like test #2 here is my code(Fenvick Tree 3D) //code deleted some tests for WA2 3 1 1 1 0 2 1 0 0 0 3 1 0 0 1 3 2 1 1 0 2 2 2 3 answer 2 2 1 0 0 0 10 1 0 0 1 10000 1 0 1 0 50 1 0 1 1 1000 1 1 0 0 5 1 1 0 1 100 1 1 1 0 1 1 1 1 1 127 2 1 1 1 1 1 1 3 answer 127 this tests useful for fenvick tree solution! Edited by author 22.04.2009 20:19 Thanks, second test helped a lot. I've got AC using java in 1 sec with 3D Fenwick tree. Solution can be improved in constant factor if search is done more effectively to avoid duplicate searches while subtracting and adding peaces. Edited by author 17.04.2011 14:39 First, Anatoly's tip helped me (see "WA#4 - I don't know why" thread). Another one tip for those receiving WA with "swear correct algo": I've multiplyed whole input data to some koef (tried 500, 800) and divided result by this koef before printing — got AC while without it got WA on 8-th test. It's all about error of calculations. And, of course, I've used double, not float. AB, AC, BC - Vectors. r - Radius. Arctangent(y, x) - Coprocessor function FPATAN, calculates an angle between vectors A(x, y) and X(1, 0)(using y and x coordinates of the A point). My algorithm: d = Abs(VectorMultiply(AC, BC)) / AB if (d >= r) then Write(Length(AB)) else begin s1 = Sqrt(Length(AC) * Length(AC) - r * r) angle1 = Arctangent(Sqrt(Length(AC) * Length(AC) - d * d), d) - Arctangent(s1, r); s2 = Sqrt(Length(BC) * Length(BC) - r * r) angle2 = Arctangent(Sqrt(Length(BC) * Length(BC) - d * d), d) - Arctangent(s2, r); s = r * (angle1 + angle2) Write(s1 + s + s2) end ----- Am I wrong? I think if you'll get following test, then you'll get 4th. 1 2 0 3 3 0 0 0 0 2 The answer is 2.24 (not 2.30) Thank's Anatoly, that helped me. Don't know, how I've missed this :) Can it be solved with monte carlo alogrithm? I used 10^6 points for checking and got WA at test #10. Then changed number of points to 10^5 and still get WA#10. Edited by author 19.10.2004 02:09 I cut the square into 10^5 stripes and WA #10. Then I magnified the picture by 10^4 times and changed real into extended, WA #10 still. Wrong test, or wrong algo? I used 10^6 points checking and I got AC=) Try to post your code I'm sure the problem there I've solved it with monte carlo alogrithm. So, i can say that it is possible 1000 => 501501000 500 => 62875500 333 => 18629685 1 => 3 3 => 30 4 => 60 But Wa#5 Edited by author 28.10.2006 17:09 The same with me: WA#5 can anybody tell me why Just use int64 instead of longint; My solution is very short and I also get WA5, my answers are the same as those posted, can anyone give some hint ? I got Accepted using BrutForce!!! Already solved this problem, read the hint below :) Edited by author 30.10.2006 21:20 Yes , me , too . WA#5 but AC now , you should change "int n" into "long long n" . Yup, 10x pal, you saved me from reading again and again this task and to wonder where I was wrong :) Who can find my mistake? [code deleted] it passes all my tests, but it can't pass 5 Edited by moderator 29.12.2006 09:16 This is my formula for (int i = 0; i <= n; ++i) res += (i + n) * (n - i + 1) / 2 + i * (n - i + 1); This one is mine: n*-~n*-~-~n>>1 Have fun! Thanks for the advice. Could you tell me what brings this change? n=10000 fits in an int, doesn't it? Ha! Got accepted only with __int64 and not with long long... my djgpp returns a compilation error on such a line... could anybody explain me what should that be? Edited by author 10.11.2006 01:16 Edited by author 02.03.2008 12:54 Edited by author 02.03.2008 12:53 Can somebody tell me the possible reason of this WA? Or at least what figure is in that test? I would be very thankful! please, give me some tests. i tried to solve this problem with dp. O(N*2) time and O(N) memory: here is my code #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int n; string s,t; string Longest_common_substr(void) { int place; int longest=0; vector<int> m(n); for(int i=0;i<n;i++) { for(int j=n-1;j>=0;j--) { if(s[j]==t[i]) { if(j!=0)m[j]=m[j-1]+1; else m[j]=1; } else m[j]=0; if(m[j]>longest) { longest=m[j]; place=j-longest+1; } if(longest==n)return s.substr(place,longest); } } if(longest==0)return ""; else return s.substr(place,longest); } int main() { ios::sync_with_stdio(0); cin.tie(); cin>>n; cin>>s; cin>>t; cout<<Longest_common_substr()<<endl; return 0; } can you please suggest any modifications? I have WA 1 but on my computer all ok. Is first test not like in statement? num = int(input()) arr = [] for i in range(num): arr.append([]) for j in range(num): arr[i].append([])
check = 1 for i in range(num-1,-1,-1): x = 0 y = i while y != num: arr[x][y] = check check += 1 y += 1 x += 1 for i in range(1,num,1): x = i y = 0 while x != num: arr[x][y] = check check += 1 y += 1 x += 1 string = '' for i in range(num): for j in range(num): string += (str(arr[i][j]) + ' ') print(string) string = '' num = int(input()) arr = [] for i in range(num): temp_arr = input().split(' ') arr.append(temp_arr) string = '' for i in range(num): k = i j = 0 while k >= 0: string += (arr[k][j] + ' ') k -= 1 j += 1 for i in range(1,num,1): k = num - 1 j = i while j != num: string += (arr[k][j] + ' ') k -= 1 j += 1 print(string) Edited by author 27.07.2013 13:58 Edited by author 27.07.2013 13:58 |
|
|