|
|
Общий форумThe problem asks you to find the diameter of a tree. If you have wa3 the following test may help you: 3 4 1 2 10 Pirated 1 2 11 Licensed 2 3 10 Pirated 2 3 8 Licensed answer Online 19 cracked can be installed on both licensed and pirated and the program remains licensed or pirated as before installation I overlooked this case and got wa3 P.S. above test case didn't help [code deleted] Edited by author 07.01.2010 14:37 In 5th constructor (pts[i] = new Point3D(B, C - (x[i] - A - C), y[i] - B - C);) X must be equal to A. I'm very inattentive Thank you, thank you This test helps me to pass test#4 3 3 3 4 7 4 2 Answer: 3.000000000 Lol, it helped indeed. I assigned Z twice instead of assigning Z and Y in the case of a bottom face of the figure. Help please! may be swap(2,3),i had wa8 and i swapped(2,3),somewhere I tried everything and cannot pass the second test .. any help? You guys have to sort the roads to be the same sequence as the input means first input,first output Edited by author 04.07.2018 23:18 Edited by author 04.07.2018 23:18 Edited by author 04.07.2018 19:52 Why did you post that? What's the point? I have an O(n*log(n)) algorithm, which works successfull on all test cases at my Celeron 300. The time of working is incredible low (I used test with 15000 stars), but timus gives me Time limit exceeded. If anyone here has an idea where is the matter, I am ready to share my program with him. Mine is O(C*n).C is a constant number! Consider the most difficult way to make your programme been dead! Do not ignore any side! If your programme is written in C or C++, maybe I can help you! Send it to my box:ls223224@163.com! You know, if you'll always allocate a segment tree of size upper bound of N you will indeed acquire an O(n) solution... Although, it will be actually slower than the O(nlogn) one. I mean, boasting about your (undescribed) O(n) is never a good thing. (And also, I wanna boast with my algorithm theory knowledge and tell you that "O(C*n).C is a constant number!" looks quite silly). Thanks a lot if anyone can give me some help! long min = n; for (int i = 0; i < k; i++) for (int j = i + 1; j < k; j++) { long diff = (data[i] + data[j] - n); if (diff < min) min = diff; } Console.WriteLine(min < 0 ? 0 : min); Sorry, it's my fault. This case find Max, not Min. Does you algorithm work (with your last changes)? It probably shouldn't (if I am correct) Consider the following 3 3 2 2 2 The answer, program will give you in this case is 1 But i can easily prove it is wrong: First man speaks dialects 1 and 2 Second one speaks dialects 2 and 3 The third speaks dialects 3 and 1 Therefore there is nobody, who can speak all three dialects Just use __int64 instead of long long. That helped me. int is enough for this problem. Using 64-bit ints didn't matter for my solution. However, this test case helped me fix WA 4: 10 3 5 4 8 the original answer of fskdkskylp is ansthisone but my accepted code give this answer aêsthisone. my accepted code #include<bits/stdc++.h> using namespace std; int main() { char c[104]; scanf("%s",c); int l=strlen(c); int a[l+5]; int b[l+5]; for(int i=0; i<l; i++) { a[i]=c[i]-'a'; } b[0]=a[0]; if(a[0]<5) { b[0]=b[0]+26; } for(int i=1; i<l; i++) { int j=1; while((b[i]=a[i]+j*26)) { if(b[i]%26==a[i]&& b[i]>=b[i-1]) break; j++; } } printf("%c",b[0]-5+'a'); for(int i=1; i<l; i++) { int j=abs(b[i]-b[i-1]); printf("%c",j+'a'); } printf("\n"); return 0; } 9 8 1 2 1 6 1 8 1 3 1 4 4 5 1 7 7 9 Answer: 3 7 9 1 2 4 5 If you've got WA #11 then your program deals bad with repeatative queries. Try this test: -------------------- 2 acm 10000 acmicpc 10000 2 ac ac --------------------- Correct answer is: --------------------- acm acmicpc acm acmicpc --------------------- this code works fine for above input but still gives wa#11 I believe, this will help you 18 a 10 ba 0 bb 1 bc 1 bd 1 be 1 bf 1 bg 1 bh 1 bi 1 bj 1 bk 1 bl 1 bm 1 bn 1 bo 1 bp 1 bq 1 1 b ba can't be with zero frequency: 1 ≤ n_i ≤ 106 Is it true that k=f(n), where f(n) is Euler function? Edited by author 13.02.2009 22:03 Yes =) 2 ADMINS: don't delete this hint. Really, it's easy to think it out - harder is to write If anyone got stuck with this. here is the well-known formula for computing phi function: phi(n) = product of [ p^{a - 1} * (p - 1) ], where factorized n = product [ p^a ]. The problem has a pretty fast brute force solution. Once you find a number K such that (K + 1) is prime and K divides phi(n) try to construct n with this prime (multiply by (K + 1) once and continue while phi(n) / (K + 1)^b is a multiple of (K + 1)). Answers for big tests is very big. For example, for test "50 500" answer is "854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321". Don't use long long or int64! Use long numbers (long arithmetic)! (Длинная арифметика) I dont have idea. Who can explain to me, how to solve this problem? thx a lot. Thank you for your hint,though I know to use long arithmetic(my arithmetic is wrong). I think the answer for the test"50 500" is "2691417369747203226859471552248904568444092968464995017156586373422740263569136967872156335261820969253753890314496",does anybody get the same answer as me? WAITING FOR HELP. I think the answer for the test"50 500" is "2691417369747203226859471552248904568444092968464995017156586373422740263569136967872156335261820969253753890314496",does anybody get the same answer as me? WAITING FOR HELP. The "HINT!" from Yegor Suvorov is correst, so yours is not. Thanks!!!:) Edited by author 19.11.2010 11:14 Edited by author 28.10.2015 19:11 Yes, I think so! I think the answer for the test"50 500" is "2691417369747203226859471552248904568444092968464995017156586373422740263569136967872156335261820969253753890314496",does anybody get the same answer as me? WAITING FOR HELP. no! the answer is "854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321" Edited by author 03.01.2017 23:05 hints :- 50 500 854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321 ( this ans is correct ) make sure value of each digit must not exceed 9 It's really very easy problem! Just shuffle! Indeed, I solved this problem by repeatedly testing random shuffles and printing NO if none of them was winning. |
|
|