Common Board| Show all threads Hide all threads Show all messages Hide all messages | | wa13 | Apollon76 | 1794. Masterpieces of World Architecture | 22 Dec 2010 23:47 | 1 | wa13 Apollon76 22 Dec 2010 23:47 Пробовал тесты в другой теме-не помогает. Программу уже тестил буквально на всё!!!!!!!! | | Test7 is correct??? | Pio | 1324. Extra Spaces | 22 Dec 2010 23:14 | 3 | I think that checker is not correct. Admins, please, check test7. too got wa7 P.S. in test 7 L=11 my program out 4 5 4 3 2 Admins why it wrong???????????? if n== 3 , your answer doesnt correct!!! the answer must correct for all the i between 1 to n. sorry for my poor english. | | WA#1 | hoan | 1221. Malevich Strikes Back! | 21 Dec 2010 19:34 | 1 | WA#1 hoan 21 Dec 2010 19:34 here is test: input: 7 1 1 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 output: No solution first my program write 3 for this. hope can help you!!! | | Numerical algo | Vedernikoff Sergey (HSE: EconomicsForever!) | 1633. Hippogriffs | 20 Dec 2010 16:31 | 10 | Numerical algo Vedernikoff Sergey (HSE: EconomicsForever!) 12 Oct 2008 05:47 Did anybody solve it with numerical algo (local optimization)? I think using Java is best way. Firstly I used parameter MaxLen=100 for BigDecimal and Wa3. Maxlen:=200 and Ac. Thus to garantie given precision in answer 1e-9 is difficult without long numbers. 2 svr: I've accepted it with usual double in C++ I and begginers must be caution. A~1e6; A'A~1e12, t^2-Qt+Z=0;Q,Z~1e24;D=Q^2-4*Z~1e+48 how take t with 1e-9 in 16 digits!? My formula uses only numbers about 10^12 ;) If you have valid analytic solution to the problem, numbers wouldn't make much difficulty, or so it seems to me. Edited by author 22.06.2010 13:54 I solved it using numerical optimization. I've got AC with a code having only 20 lines. | | multiset VS priority_queue | JackVoo | 1306. Sequence Median | 19 Dec 2010 18:11 | 2 | I use the multiset initially with the similar method. However, I had a memory limit exist. After, I saw the discussion, then I change the container to priority_queue. Then I am able to solve the quetion. I just wonder, why with the similar algorithm, the memory usage is different? 1 396 KB vs 972 KB. The memory usage of multiset is more than simple array is used then sorted. 1 084 KB multiset uses Red-Black Tree data structure, so it stores for every element not only it's value (4 bytes), but also addresses of it's parent (4 bytes more), both children (8 bytes) and color (enum, 4 bytes). So, as you can see, it spends 28 bytes for every element versus 4 bytes at priority_queue | | WA #5 | coders1122 | 1577. E-mail | 19 Dec 2010 14:38 | 5 | WA #5 coders1122 28 Oct 2010 20:09 see the second sample on your site. the answer is 2. Any suggestions on improvement of the algorithm i use? Is my approach wrong or can be fine with some tweaking? Ravi Kiran. If in your current state s1[i]==s2[j], you should not assume states i+1,j and i,j+1. Only i+1,j+1. Thanks a lot everyone. I got accepted with the change you suggested. | | Crash test 2 | zAlogic | 1086. Cryptography | 18 Dec 2010 23:26 | 2 | have test: 1 2 -> 5 1 150000->656233 1 20 ->71 Right? What test may give Crash in test 2? 1. maximum can be 15000, not 150000 2. you might be using excess memory (too many arrays, array variables) have to shorten it... | | WA#2 | hoan | 1169. Pairs | 18 Dec 2010 21:39 | 1 | WA#2 hoan 18 Dec 2010 21:39 the graph is simple!!! input: 2 0 output: -1 GOOD LUCK!!! | | WA #2 help! | akash | 1020. Rope | 18 Dec 2010 13:56 | 2 | #define _USE_MATH_DEFINES #include<stdio.h> #include<math.h> int cal(double x1, double y1, double x2, double y2){ int d; d=sqrt(pow((x2-x1),2)+pow((y2-y1),2)); return d; } int main(){ int no_of_nails,j; double radius; double total_length=0; double x1,y1,x2,y2; double nextx,nexty,prevx,prevy; fscanf(stdin, "%d %lf",&no_of_nails,&radius); getchar(); total_length += no_of_nails * ((M_PI*radius)/2); if(no_of_nails==1) { total_length += M_PI*2*radius; printf("%0.2lf",total_length); return 0; } fscanf(stdin,"%lf %lf",&x1,&y1); fscanf(stdin,"%lf %lf",&x2,&y2); total_length+=cal(x1,y1,x2,y2); prevx=x2; prevy=y2; if(no_of_nails>2){ for(j=no_of_nails-2;j>0;j--){ fscanf(stdin,"%lf %lf",&nextx,&nexty); total_length += cal(prevx,prevy,nextx,nexty); prevx=nextx; prevy=nexty; } total_length += cal(prevx,prevy,x1,y1); } printf("%0.2lf",total_length); return 0; } understood my mistake, 2pir :) got AC. | | tebidohtebidoh | Ahmed Ahmedov | 1723. Sandro's Book | 18 Dec 2010 08:50 | 2 | so, can I output "t" since, since it is encountered 3 times???? I mean the only way to measure how strong a spell is, is to count how to many times it is encountered in the Universal spell. I cannot see "t" occuring three times in the string tebidohtebidoh. But the answer can also be "t" because it occurs twice and so does tebidoh. | | Po4emu vivoditsya oshibka Compilation error na yazike C | Abdu | 1001. Reverse Root | 17 Dec 2010 22:39 | 1 | #include <stdio.h> #include <math.h> int main() { freopen("input.txt", "r", stdin); int i=0; int k; double arr[100000]; float temp; while(scanf("%f", &temp)!=EOF){ arr[i]=temp; i++; } for(k=i-1; k>=0; k--) printf("%.4f\n", sqrt(arr[k])); return 0; } | | WA13 | sos1g3 [TSOGU] | 1794. Masterpieces of World Architecture | 17 Dec 2010 22:10 | 4 | WA13 sos1g3 [TSOGU] 17 Oct 2010 23:38 if you have wa13, try test 4 4 4 4 3 answer is 2 Re: WA13 Moonstone [Samara SAU] 18 Oct 2010 01:15 4 4 4 3 4 1 2 3 1st and 4th positions are equal in both sequences. I tried this test,it works.But I have wa13! When I test 3 1 1 1 answer is 1. Edited by author 17.12.2010 22:15 | | Генерация графов | r1d1 | | 17 Dec 2010 21:54 | 6 | Всем добрый день. Мне нужно сгенерировать все графы следующего типа: 1. Направление ребер не имеет значения; 2. Количество ребер не больше 20; 3. Граф должен быть связным; 4. Граф не должен содержать петель и кратных ребер; 5. Граф должен состоять только из циклов (не должно быть вершин степени 1). Затем нужно среди изоморфных графов оставить только один. Время работы программы в принципе не важно (но должно быть в разумных пределах, не больше 15 мин.). Есть идеи? Brute-force, I suppose. Your description is not quite clear: "only from cycles" and "no vertices of degree one" is different things. If only from cycles - then a good way to generate such graphs is firstly to take "ring" (brute-force different ones), then take different pairs of vertices in it and connect them with "threads" (also trying different lengths), one the next step again take all pairs of vertices and connect them, and so on. Normalization is as usual. I suppose, number of such graphs should not be too large. Спасибо! Есть идеи как удалить изоморфные графы? Edited by author 17.12.2010 09:19 As usual: introduce some normalization procedure, then if the result of normalization coincides with the initial graph - then it is the representative of isomorphic group, otherwise it is not. But the first thing to do is to try to generate as few isomorphic graphs as possible in your brute-force procedure. Я этого никогда раньше не делал, поэтому довольно плохо себе все представляю. Что за процедура нормализации? Можно поподробнее? И я плохо понимаю по-английски, пиши мне в следующий раз на почту, r1d1-911@mail.ru Edited by author 17.12.2010 21:55 | | use heap, no RB tree!!! | hoan | 1147. Shaping Regions | 17 Dec 2010 18:03 | 1 | first i use RB tree (set in C++) and got AC in 0.796s and when i use heap i AC in 0.156s. my algo is (n^2* log(n)). GOOD LUCK!!! | | Brute force with some optimization get AC in 0.375!!! | Tigran92[RAU_902] | 1727. Znaika's Magic Numbers | 17 Dec 2010 12:26 | 2 | | | Be careful about Microsoft STL Merge. | [York Hotel] 3xian | 1542. Autocompletion | 17 Dec 2010 12:07 | 1 | At first I got lots of WA #1 at this problem, but I was confident in my algo. When I replaced stl::merge with stl::sort, I got AC. When I replaced stl::merge with stl::inplace_merge, I got AC, too. After that, I tried to rewrite the stl::merge myself, and also got AC. Then I copied the source code of stl::merge from "include\c++\3.4.2\bits\stl_algo.h", and ... also AC. Does it mean that there is something strange in stl::merge of Visual C++ 2010? UPD: I have found that the stl::merge in Visual C++ 2010 sometimes will modify the elements in the origin vector. Be careful to use it! PS: /* G++ merge */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator> _OutputIterator merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator1>::value_type>) __glibcxx_function_requires(_SameTypeConcept< typename iterator_traits<_InputIterator1>::value_type, typename iterator_traits<_InputIterator2>::value_type>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_InputIterator1>::value_type>) __glibcxx_requires_sorted(__first1, __last1); __glibcxx_requires_sorted(__first2, __last2); while (__first1 != __last1 && __first2 != __last2) { if (*__first2 < *__first1) { *__result = *__first2; ++__first2; } else { *__result = *__first1; ++__first1; } ++__result; } return std::copy(__first2, __last2, std::copy(__first1, __last1, __result)); } /* VC++ 2010 merge */ template<class _InIt1, class _InIt2, class _OutIt> inline _OutIt _Merge(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2, _OutIt _Dest) { // copy merging ranges, both using operator< for (; _First1 != _Last1 && _First2 != _Last2; ++_Dest) if (_DEBUG_LT(*_First2, *_First1)) { // merge first *_Dest = _Move(*_First2); ++_First2; } else { // merge second *_Dest = _Move(*_First1); ++_First1; } _Dest = _Move(_First1, _Last1, _Dest); // copy any tail return (_Move(_First2, _Last2, _Dest)); } Edited by author 17.12.2010 14:20 | | TO ADMINS: 1085 problem | hoan | | 17 Dec 2010 01:15 | 2 | my old AC code has WA on this test, please add this: 4 3 2 1 4 2 4 3 2 3 2 2 100 1 0 0 2 0 Edited by author 14.12.2010 23:04 Your test is incorrect. "...there is a positive integer in the beginning of a line that is an amount of money (in rubles) the person has..." But second person has 0 rubles in your test. | | задача на расстановку ферзей | disa | | 16 Dec 2010 23:58 | 3 | Здравствуйте. Помню что видел на сайте задачу про расстановку ферзей на доске большого размера. Подскажите ее номер или название. | | why semple is correct? | Den | 1128. Partition into Groups | 16 Dec 2010 23:24 | 1 | 8 3 2 3 7 3 1 3 7 3 1 2 7 1 6 0 2 4 8 3 1 2 3 1 6 why i can't make group like this: 1: 1 2 6 2: 3 4 5 7 8 ??? | | Please someone tell me what test 9 is!! | Hakobyan Tigran (RAU) | 1795. Husband in a Shop | 16 Dec 2010 19:37 | 2 | I have about 50 wrong submissions,please help me with test #9. Edited by author 11.12.2010 17:01 With following block : if (shop.get(current.need) == null) { q.removeFirst(); // husband goes home with nothing } i had WA9 when I changed it to if (shop.get(current.need) == null || shop.get(current.need) == 0) { q.removeFirst(); // husband goes home with nothing } i got AC. May be this helps you. |
|
|